今天使用引入react-native-swiper組件使用輪播圖時,發現報如下錯誤:
Invarint Violation:ViewPagerAndroid has been removed from React Native.
上網查了下,最終使用如下方法解決:
- 移除掉remove react-native-swiper這個包:
yarn remove react-native-swiper
- 安裝新包:
yarn add react-native-swiper@nightly
使用方法和引入包的名稱和react-native-swiper完全一樣,為什么這樣的原因不詳,但是成功解決了問題。