Which versions are you using:
it should swipe to next
its not swiping to next slide
To help us, please fork this component, modify one example in examples folder to reproduce your issue and include link here.
-
React Native just moved the ViewPager from its core and to a separate package @react-native-community/viewpager
which is used in this component, I just had to change the ViewPagerAndroid in the component code to be imported from the separate package and it worked.
import ViewPagerAndroid from "@react-native-community/viewpager";
I had this issue using 1.5.14 but I updated to 1.6.0-nightly.5 and it's now working, weird you are still seeing this in v1.6. This was fixed in #997
@ursNj I cann't reproduce it by using the example project
=> https://github.com/leecade/react-native-swiper/tree/develop/examples
Can you provide one example as the issue template show?
A quick workaround is that
Install and auto link npm i @react-native-community/viewpager
then run react-native run-android
Go to node_modules\react-native-swiper\src\index.js and
remove ViewPagerAndroid import from 'react-native' and add this import ViewPager from "@react-native-community/viewpager";
and then at line 652 of index.js replace <ViewPagerAndroid /> with <ViewPager/>
that made it work for me.
It's fixed in 1.6.0-rc.1
A quick workaround is that
Install and auto link npm i @react-native-community/viewpagerthen
run react-native run-androidGo to node_modules\react-native-swiper\src\index.js and
remove ViewPagerAndroid import from 'react-native' and add this
import ViewPager from "@react-native-community/viewpager";and then at line 652 of index.js replace
<ViewPagerAndroid />with<ViewPager/>that made it work for me.
Works for me, THX
There is a version, that contains updated ViewPager: https://www.npmjs.com/package/react-native-swiper/v/1.6.0-dev.1
These steps helped for me:
https://github.com/leecade/react-native-swiper/issues/1108#issuecomment-555037592
While the import is fixed, it seems to be only a temporary solution.
Tried to register two views with the same name RNCViewPager 修改之后报这个错了
//Tried to register two views with the same name RNCViewPager
I use the version
"react-native-swiper": "^1.6.0-rc.3"
it work on 0.61.5
import ViewPager from "@react-native-community/viewpager";
Should do this:
import ViewPagerAndroid from "@react-native-community/viewpager";
You have never to touch the node modules source code, later when you make an update or reinstall the packages you will loose the changes you have made
So the best solution should be this command line :
yarn add react-native-swiper@next
hello,
I am new to react native, I am trying to implement react-native-swiper to my project
` render() {
return (
showsPagination={false}
index={1}>
<View style={this.viewStyle()}>
<ActivityScreen />
</View>
<Swiper
horizontal={true}
loop={false}
showsPagination={false}
index={1}>
<View style={this.viewStyle()}>
</Swiper>
<View style={this.viewStyle()}>
<AlertScreen />
</View>
</Swiper>
)
}
}
`
But when I am "YourGroups" screen and click on the button
<Button title="thank you" onPress={()=>this.props.navigation.navigate("ThankScreen")} ></Button>
I get an error
undefined is not an object (evaluating 'this.props.navigation.navigate')
Most helpful comment
A quick workaround is that
Install and auto link npm i @react-native-community/viewpager
then
run react-native run-androidGo to node_modules\react-native-swiper\src\index.js and
remove ViewPagerAndroid import from 'react-native' and add this
import ViewPager from "@react-native-community/viewpager";and then at line 652 of index.js replace
<ViewPagerAndroid />with<ViewPager/>that made it work for me.