-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Android: Nested tab-view doesn't display children #105
Comments
I am not sure if there's anything I can do to fix it. you can use the |
I'll check that out |
If anyone else is having this problem here's my implementation of the workaround suggested by satya164, loosely based on the ScrollViewExample code here. Thanks for the tip btw, I was really stuck on this! import { Platform } from 'react-native'
import { TabViewAnimated, TabViewPagerScroll, TabViewPagerPan, TabBar } from 'react-native-tab-view'
/* ... Omitted for brevity ... */
_renderPager = (props) => {
return (Platform.OS === 'ios') ? <TabViewPagerScroll {...props} /> : <TabViewPagerPan {...props} />
}
render () {
return (
<TabViewAnimated style={styles.container}
navigationState={this.state}
renderScene={this._renderScene}
renderHeader={this._renderHeader}
onRequestChangeTab={this._handleChangeTab}
renderPager={this._renderPager}
/>
)
}
} |
@Polidoro thanks for the snippet. nested Tabview on Android is finally functional. :) |
Can you paste your code? Also what version of react-native-tab-view are you using (since as jasan-s mentioned the behavior changed recently) |
@Polidoro thanks for the fast response! this is my class. Basically a copy from the example page.
|
I assume you're on v0.0.61? Does the error occur on Android too or just iOS? Have you tried swapping the ScrollView out for a regular View to see if that has any impact? |
I was on v0.0.62, downgraded to .61 and it works now! Thanks a bunch @Polidoro |
Definitely a bug with React Native since I'm not doing any weird stuff here. And I was able to successfully nest it. |
Are you sure? After diving into this today I found that on the second time I change tabs, When I wait 30 seconds between each click, this does not occur. Also when I don't use TabViewPagerPan on Android it works just fine.. |
Please open a new issue with the code if there is an infinite loop and I'll look into it. |
@satya164 that was the error I got implementing Polidoro's fix with V 0.0.6.2. With V0.0.6.1 the error was gone, but now I have an inf loop. I'll create a new issue, thanks. |
Not sure if this helps clarify but I wrote that snippet well before v0.0.62 was released. v0.0.59 (or around there) made that workaround unnecessary. |
I'll downgrade again, thnx for the headsup. However even if it fixes it, the inf loop is still worth looking into. |
@Polidoro the downgrade fixed it again. V0.0.59 in combination with your implementation above works perfectly! @satya164 let me know if you want to explore the inf loop with me on V0.0.61. I can create an issue. |
Please create an issue. I'm on vacation right now, but will look as soon as I get time. |
i have not tried this yet but I'm about to switch to react-navigation which uses this lib. @Polidoro , how would I conditional render pagers for it, since I don't think you have direct access to the same props ? |
Hi @jasan-s! I'm no expert but you might be able to set conditional rendering by using the If you can explain in more detail what you're trying to accomplish maybe I can be more helpful? |
On Android, there are some issues with ViewPagerAndroid, when it's nested inside a ScrollView.
This is a description of the issue on a similar component:
ptomasroos/react-native-scrollable-tab-view#187
Also, I think this is what the user that opened #24 meant.
If you edit TabViewAnimated.js like this, it works on Android
The text was updated successfully, but these errors were encountered: