Open Angelk90 opened 6 years ago
i solved by this,i think one content is for one part.so when i use Content for the two parts,they have the same height.
<SafeAreaView style={{ flex: 1 }}>
<Container>
{/* <Content> */}
<Tabs>
<Tab heading="回复详情">
<Content>{checkRecordList.map(this.renderRecord)}</Content>
</Tab>
<Tab heading="传阅详情">
<Content>{checkRepostList.map(this.renderRepost)}</Content>
</Tab>
</Tabs>
{/* </Content> */}
<StickyFooterBtn
onPress={() => this.props.navigation.navigate('VerifyResponse', { documentCheckId })}
text="回复"
/>
</Container>
</SafeAreaView>
@tunshiyu:
Could you give an example by posting it on snack.expo.io?
Did someone find a workaround?
The workaround it to always have scrollview as the outer most element within a tabpane, with height of 100% for the scrollview.
If you need tabs or something at the bottom of the screen fixed, include it outside of the scrollview / tabview and add a bottom padding to the tabStyle equal to the fixed bottom items height
@Cookizza Can you post some code snippet for your workaround?
I was able to fix this issue with the following snippet
<Container>
<Tabs>
<Tab header="Tab1">
<Content>{/* You tab contents */}</Content>
</Tab>
<Tab header="Tab2">
<Content>{/* You tab contents */}</Content>
</Tab>
</Tabs>
</Container>
This solved 2 issues for me:
Hi @Angelk90, this code snippet is the format of using Tabs
.
<Container>
<Header hasTabs />
<Tabs>
<Tab heading="Tab1">
<Content>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
<Text>Hii</Text>
</Content>
</Tab>
<Tab heading="Tab2"></Tab>
<Tab heading="Tab3"></Tab>
</Tabs>
</Container>
Hi, i hope it has been fixed. Please update to latest Native-Base v2.13.14 . Please let us know if the issue still persists. Closing for now.
@hanykumar : The problem persists was not solved at all. Here is an example with updated versions, please reopen the issues, problem not solved. Link: https://snack.expo.io/3TIg!455J
i solved it by this way
<Container>
<View>
<Tab heading="hasLessData >
<Screen1 />
</Tab>
<Tab> heading="hasMoreData">
<ScrollView>
<Screen2 />
</ScrollView>
</Tab>
</View>
</Container>
I'm having the same issue. My tabs are like are situated about 30% from the page-top, and when I scroll the tabs disappear.
Tallest tab height taken for all tabs.
why isn't this issue hasn't been fixed yet :( since my data is dynamic i couldn't find out the best solution mentioned above can anyone help me out
<Tabs
locked
onChangeTab={onChangeTab}
initialPage={initialPage}
tabContainerStyle={styles.tabContainer}
tabBarUnderlineStyle={styles.tabsUnderline}
>
{content.map(arr => (
<Tab
textStyle={styles.activeText}
activeTabStyle={styles.activeTab}
activeTextStyle={styles.activeText}
tabStyle={styles.tab}
style={styles.tabContents}
key={arr.tab}
heading={arr.tab}
>
{arr.component()}
</Tab>
))}
</Tabs>
</View>```
react native fix your shit this is actually embarrassing
This is hardly the fault of react-native. All it takes is a little thinking. Namely, you can't have tabs inside scrollviews. And that makes absolute sense. How would that ever work? Of course it would need to use some silly onLayout hack.
Tabs cannot be in scroll views - the tab should always be 100% height. The tab content itself can contain a scrollview if you need scrolling.
That is the purpose of the tabs component. The content within tabs scroll - not the tab itself.
If you are facing this problem take some time to consider your layout structure and if there's a scrollview of some sort somewhere further up your layout chain that doesn't really need to be there. I know I tend to overuse scrollviews.
Tallest tab height taken for all tabs.
why isn't this issue hasn't been fixed yet :( since my data is dynamic i couldn't find out the best solution mentioned above can anyone help me out
<Tabs locked onChangeTab={onChangeTab} initialPage={initialPage} tabContainerStyle={styles.tabContainer} tabBarUnderlineStyle={styles.tabsUnderline} > {content.map(arr => ( <Tab textStyle={styles.activeText} activeTabStyle={styles.activeTab} activeTextStyle={styles.activeText} tabStyle={styles.tab} style={styles.tabContents} key={arr.tab} heading={arr.tab} > {arr.component()} </Tab> ))} </Tabs> </View>```
Make the tabs 100% height & move scrollview to inside the actual tab content component. Tabs shouldn't be inside any type of scroll view so you may want to check for that. This will of course stop the tab headings from scrolling - but if you need this, all you really need is conditional rendering, not tab component.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@GeekyAnts, @akhil-geekyants, @SupriyaKalghatgi, @shivrajkumar, @normdoow, @cbaker, @LasithaPrabodha, @andrew-luchkevych, @flashimxd, @shekharskamble, @lucie-macikova, @amaljosea, @tarun29061990, @harishlalwani, @Johncy1997, @Donhv, @AbanoubNassem, @maartenvandillen, @girginsoft , @victorsousadev , @gauravroy1995, @fxbayuanggara , @Cookizza, @tunshiyu, @ofgowtham , @ishdemon, @bharatpatil , @hanykumar, @Salman98 , @grimsammie , @Muralidevan :
I hope I haven't forgotten anyone. Even after years this problem seems to still persist, I think it is time to understand what the problem is and find a solution.
For those wishing to find the solution here is an example of the problem: https://snack.expo.io/-3wZ2AsKU
Please do not use different code or at least post a complete example on https://snack.expo.io to be able to test it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@GeekyAnts, @akhil-geekyants: Link Video: https://drive.google.com/file/d/1ifx1orms0PHYb3LLhf5lcwrVFyjPVk1j/view
Hi, I'm using tab. As you can see from the video, native base in this case behaves very strangely, as if it were broken.
First problem: The tabs are not fixed under the toolbar, as they normally should.
Second problem: I am in the first "TAB1" (Info), I scroll, no problem except for the fact that the "TABS" should be fixed. I click on the "TAB2" (Movie), the elements are rendered. I do not even need to scroll the elements, if I click on the "TAB1" (Info) already, it will take the same height as the "TAB2" (Movie), that is the maximum height rendered.
Instead, as usual, each TAB should have its own height.
react-native, react and native-base version
"native-base": "^2.3.3", "react": "16.1.1", "react-native": "0.50.4"
Expected behaviour
Actual behaviour
Steps to reproduce (code snippet or screenshot)
Link expo to try it: https://snack.expo.io/HJrZ9jXEf
Code:
Screenshot of emulator/device
Link Video: https://drive.google.com/file/d/1ifx1orms0PHYb3LLhf5lcwrVFyjPVk1j/view
Is the bug present in both ios and android or in any one of them?
Yes, the problem is present on both.