React-native-swiper: ViewPagerAndroid has been removed... on 1.6.0-nightly.5

Created on 12 Nov 2019  路  23Comments  路  Source: leecade/react-native-swiper

Which OS ?

Android

Version

Which versions are you using:

  • react-native-swiper v1.6.0-nightly.5
  • react-native v0.61.4

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

Most helpful comment

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.

All 23 comments

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 ?

the same for me. Any updates?

I solve it by:
1- install this module: react-native-community / viewpager
2- Go to the file: node_modulesreact-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

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_modulesreact-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 \androidapp\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.

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

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.

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 .

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

@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_modulesreact-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.

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

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.

swiper container style props name change: style => containerStyle

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

@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_modulesreact-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 :)

I solve it by:
1- install this module: react-native-community / viewpager
2- Go to the file: node_modulesreact-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!

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.

for me it was enough to have the dependency

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

I had the same issue
I solve it by

  1. npm uninstall react-native-swiper
  2. npm I --save react-native-swiper@nightly

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

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chetanparakh picture chetanparakh  路  3Comments

agzuniverse picture agzuniverse  路  3Comments

AndrewSouthpaw picture AndrewSouthpaw  路  3Comments

nicolabortignon picture nicolabortignon  路  3Comments

itinance picture itinance  路  3Comments