Android
Which versions are you using:
Working Swiper
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'
I tried with the example on README, same error.
-
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:
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!
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
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
working
鬲氐賲賷賲 鬲胤亘賷賯丕鬲 丕賱噩賵丕賱
@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 ViewPagerThis 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
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:
Unistall
npm uninstall react-native-scrollable-tab-view
Install
npm i react-native-scrollable-tab-view
Most helpful comment
Update: I removed 1.5.14 (
yarn remove react-native-swiper) then installed the nightly withyarn add react-native-swiper@nightlyand it's working on Android now.