-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android rendering children of View as separate pages #186
Comments
I see expo uses 3.3.0 version, which is the most stable. You have not passed styles to |
Hey! Thanks for your suggestion. The screenshots above were from @react-native-community/[email protected], and were also on Expo 37. It's also not working when adding import React from "react"
import { StyleSheet, View, Text } from "react-native"
import ViewPager from "@react-native-community/viewpager"
export const MyPager = () => {
return (
<ViewPager style={styles.viewPager} initialPage={0}>
<View key="1">
<Text>First page a</Text>
<Text>First page b</Text>
<Text>First page c</Text>
</View>
<View key="2">
<Text>Second page a</Text>
<Text>Second page b</Text>
<Text>Second page c</Text>
</View>
</ViewPager>
)
}
const styles = StyleSheet.create({
viewPager: {
flex: 1,
marginTop: 200,
},
}) iOS Demo code: Android demo code: and a screenshot of scrolling half way through to show they are one page each: |
Hey! Same issue for me too. Only occurs on Android while works completely fine on ios. Any fixes? style={{flex:1}} doesn't fix anything. @bitttttten were you able to figure out? |
@debuggermalhotra I haven't figured it out yet. I am still looking into alternatives.. |
@bitttttten is this exclusive to Expo? Can you replicate the problem on React Native without Expo? |
I only have ever used Expo with RN, but I did create a bare Expo app and could reproduce this issue in there too. I don't actually know how to make an RN without Expo yet. |
Give it a try without Expo and let me know if you can reproduce. It might be Expo related. |
@bitttttten I found a workaround. Just wrap the child |
Adding |
https://reactnative.dev/docs/view.html#collapsable
@taingmeng you are right. Maybe we should consider to add this property by default. |
I agree with this. Actually the way I found a solution to this problem was by looking through the issues with this library and luckily I found this post. Would be nice if the Viewpager could have a property for this which is default to |
Facing multiple pages rendered for children within the page on Android as well. expo: 39.0.3 |
Hey! I faced same issue on android.
|
@JalalAliyev which version are you using? |
That's only a version range. Run |
this is output of yarn why react-native-pager-view command: |
@andreialecu Was I able to answer your question in detail? |
Yes, and the first problem is that you're running an old version, update to the latest. |
I'm seeing this now on iOS: incomplete transitions between pages resulting in half pages being shown. The README is unclear, is |
Also I'm getting page jumps to previous pages when the keyboard opens - is there a known resolution to this? |
I didn't have time to fight this but just to let anybody who reads this know, I switched to just basic screens with |
Hej, can you pls explain how you switched to basic screens? I am not sure how to replicate it. Thanks! |
Summary
On Android, all children of children elements get rendered onto their own pages.
Environment info
Library version: Expo 37.0.0
Steps to reproduce
Renders incorrectly on Android. I have 4 screens here that I can swipe through, but I expect only 2 screens with text underneath.
Renders correctly on iOS, with the Text being underneath each other.
The text was updated successfully, but these errors were encountered: