initialPage偶发性无效
Synaric opened this issue · 8 comments
Synaric commented
Describe the bug
以下是我的代码,页面会偶发显示第0页,华为手机:
let {index} = this.props
...省略代码
<TabView
ref={(ref) => {
this.tabView = ref;
}}
tabs={tabs}
locked={true}
averageTab={false}
initialPage={index || 0}
activeTextStyle={styles.tabActive}
inactiveTextStyle={styles.tabNormal}
renderScene={this.renderScene}
renderTabBar={(props) => {
return (
<Tabbar
{...props}
lineStyle={styles.lineStyle}
style={{
paddingLeft: rpx(20),
paddingRight: rpx(0),
paddingBottom: rpx(32),
}}
tabItemStyle={{width: rpx(146), height: rpx(50)}}
/>
);
}}
/>
诡异的是调试模式无法复现,release包多点几次可以复现
Expected behavior
Package versions
"react-native-head-tab-view": "^4.0.0-rc.11",
"react-native": "^0.63.4",
Synaric commented
补充一下导航库版本,不知是否相关:
"react-native-navigation": "^7.11.3",
render()中打印已知this.props.index的值是正常的
Synaric commented
标签页组件确实是自己封装的FlatList,显示订单列表
不过问题是,tab的显示也是不正常的,例如以上代码,index打印为1,结果tab第0个高亮
zyslife commented
@Synaric 标签页组件如果是你自己封装的,那么你应该是自己去实现一个转换文件吧,类似我提供的react-native-scrollable-tab-view-collapsible-header
和 react-native-tab-view-collapsible-header
。
看看是否这个转换文件 渲染tab的地方有问题。
Synaric commented
明白了有版本差异,我是从1.1.4升级的,为了解决点击tab会崩溃的问题
Synaric commented
没有了,谢谢