leecade / react-native-swiper

The best Swiper component for React Native.
MIT License
10.41k stars 2.34k forks source link

ViewPagerAndroid has been removed... on 1.6.0-nightly.5 #1108

Open SasonBraha opened 4 years ago

SasonBraha commented 4 years ago

Which OS ?

Android

Version

Which versions are you using:

Expected behaviour

Working Swiper

Actual behaviour

The component is throwing an error:

ViewPagerAndroid has been removed from React Native. It can now be installed and imported from 'react-native-viewpager' instead of 'react-native'. See https://github.com/react-native-community/react-native-viewpager'

How to reproduce it

I tried with the example on README, same error.

Steps to reproduce

  1. Copy the example code from the README
  2. react-native run-android
hitallow commented 4 years ago

It really isn't working for me in the same version, I believe the import inside the component created by it is importing from "react-native" and not "@ react-native-community / viewpager" so react-native gives us this error .

Any solution ?

andriinegustorov commented 4 years ago

the same for me. Any updates?

alaast commented 4 years ago

I solve it by: 1- install this module: react-native-community / viewpager 2- Go to the file: node_modules\react-native-swiper\src\index.js, and : add this line: import ViewPager from '@react-native-community/viewpager'; and remove this ViewPagerAndroid from the imports. 3- in the same file, go to the return function, and change ViewPagerAndroid to ViewPager

This works for me

henkkasoft commented 4 years ago

I just had a fight with this and here is the solution that helped with me. I tried with several builds (react-native-swiper v1.6.0-nightly.5 and 1.6.0-rc.3 and some else I think) and always got "ViewPagerAndroid has been removed from React Native" -problem. And always when I checked \node_modules\react-native-swiper\src\index.js there were no ViewPagerAndroid used anymore. Actually noticed that the error referenced a method renderScrollView line 652 which is the correct line of that method in version 1.5.14 so it tried to use that version when building.

Tried several times with different kind of cleaning and finally I managed to clean all caches and temp files and the swiper started to work:

  1. Deleted every file that were not in use from \AppData\Local\Temp\ (don't know if broke something else with this)
  2. Run in project android folder: gradlew cleanBuildCache
  3. Wiped all data from simulator (or delete the app from device)
  4. Deleted folder \android\app\build
  5. Deleted node_modules folder
  6. Run npm cache clean --force
  7. Run npm install
  8. Run npm start -- --reset-cache
  9. stopped the execution with ctrl+c, when it said it did some cache reseting
  10. launch simulator
  11. Run react-native run-android

Probably many steps are not needed but only build and node_modules folder delete did not help for me. I am working on windows 7 Really hope this help someone, it took me several hours.

bobber205 commented 4 years ago

Happening on 1.5.14 as well. I think this should be marked as very urgent.

bobber205 commented 4 years ago

Update: I removed 1.5.14 (yarn remove react-native-swiper) then installed the nightly with yarn add react-native-swiper@nightly and it's working on Android now.

jhugg11 commented 4 years ago

I was facing the same problem on 1.5.14 and the upgrade to the nightly version fixed the issue in Android for me as well, as suggested by @bobber205 .

alex-mironov commented 4 years ago

Any updates here? I installed "react-native-swiper": "^1.6.0-nightly.5", and still face the same issue.

henkkasoft commented 4 years ago

@alex-mironov I had exact the same problem and it was solved by cleaning everything. You can check if it is a cleaning issue by looking from the \node_modules\react-native-swiper\src\index.js and search for ViewPagerAndroid. If there aren't any, it is a cleaning issue. (1.6.0-nightly.5 uses ScrollView)

You can look how I cleaned my environment and get it working from my previous post.

liqiang861220 commented 4 years ago

@bobber205 it's working on Android now. thank you!

HarshitMadhav commented 4 years ago

This is the same issue posted here : https://github.com/leecade/react-native-swiper/issues/1071

The solution to this issue https://github.com/leecade/react-native-swiper/issues/1071#issuecomment-536890824

Kailash23 commented 4 years ago

Solution: ViewPagerAndroid has been removed... in the nightly build

@henkkasoft You just have to restart your system, if you are getting the same error (ViewPagerAndroid has been removed... ) in the nightly build or other ^1.6.0-rc.x versions. It's a cache problem that got cleared after the system restart.

lancerfox commented 4 years ago

swiper container style props name change: style => containerStyle

hemant-kml commented 4 years ago

Replace Android view pager with ScrollView Steps: go inside node-modules => react-native swiper inside the src open index.js find a method that returns ViewPagerAndroid replace them with ScrollView {react-native} and start your server again

ashrafayad commented 4 years ago

working تصميم تطبيقات الجوال

amcsi commented 4 years ago

@alex-mironov I had exact the same problem and it was solved by cleaning everything. You can >check if it is a cleaning issue by looking from the \node_modules\react-native-swiper\src\index.js > and search for ViewPagerAndroid. If there aren't any, it is a cleaning issue. (1.6.0-nightly.5 uses ScrollView)

You can look how I cleaned my environment and get it working from my previous post.

Yup, @henkkasoft was right. So in order to clear that cache, I had to run: npm start -- -c. Now it works for me :)

wansiklee commented 4 years ago

I solve it by: 1- install this module: react-native-community / viewpager 2- Go to the file: node_modules\react-native-swiper\src\index.js, and : add this line: import ViewPager from '@react-native-community/viewpager'; and remove this ViewPagerAndroid from the imports. 3- in the same file, go to the return function, and change ViewPagerAndroid to ViewPager

This works for me

Works for me, THX!

pierceo commented 4 years ago

Updating the react-native-swiper to nightly version alone did not fix it for me.
Actually it was the metrobundler that was caching the old react-native-swiper package. Once I cleared the metro cache (in C:\Users[username]\AppData\Local\Temp on windows) it works again. Hopefully this helps someone.

jonno85 commented 4 years ago

for me it was enough to have the dependency

"react-navigation-tabs": "^2.0.0",

itguymax commented 4 years ago

I had the same issue I solve it by

  1. npm uninstall react-native-swiper
  2. npm I --save react-native-swiper@nightly
xlcrr commented 4 years ago

Fixed by installing nightly build, deleting node modules and reinstalling them

shankarGdev commented 4 years ago

Upgrade to latest release to fix it

1) Uninstall it npm uninstall react-native-swiper 2) Install latest build (1.6.0) npm i react-native-swiper

jimmy30 commented 4 years ago

Since I was not using "react-native-swiper". My issue was related with older version of "react-native-scrollable-tab-view". I upgraded version from "0.10.0" to "1.0.0" and it solved the issue.

You can do:

  1. Unistall npm uninstall react-native-scrollable-tab-view

  2. Install npm i react-native-scrollable-tab-view