无法将其他组件内部的createMaterialTopTabNavigator显示为组件

时间:2019-06-07 09:12:54

标签: react-native

无法显示标签栏(createMaterialTopTabNavigator),而其容器的大小没有固定。请帮助

我创建了一个屏幕,其中父scrollView内有3个<View>。 3个视图包含<Tab/>,即createMaterialTopTabNavigator

<ScrollView>
    <View>other view</View>
    <View>Other view</View>
    <View style={styles.bottomSec} onLayout={event => { _scrollToBottomY = event.nativeEvent.layout.y; }}>
        <TouchableOpacity style={styles.scrlBarTapable} onPress={() => { this.refs.scrollView.scrollTo({ x: 0, y: _scrollToBottomY, animated: true }) }}>
            <View style={styles.scrlBar}></View>
        </TouchableOpacity>
        <View style={styles.SectionStyle}>
            <TextInput
                style={{ fontSize: 14, backgroundColor: '#fafafa', color: '#868686', opacity: 0.6 }}
                placeholder='Tell us what are you looking for (Price/MRP search)'
            />
        </View>
        <Tabs screenProps={{ onPackClick: this.onPackClick }} />
    </View>
</ScrollView >
bottomSec: { marginTop: 64, backgroundColor: '#ffffff', height: 1000 },
scrlBarTapable: { width: '100%', height: 30, paddingTop: 5, alignItems: 'center', backgroundColor: '#ffffff', },
scrlBar: { width: '20%', height: 10, backgroundColor: '#d7d7d7', borderRadius: 4, marginTop: 14, },
SectionStyle: {
    flexDirection: 'row',
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#fafafa',
    height: 40,
    borderRadius: 5,
    paddingLeft: 16,
    borderColor: '#ececec',
    margin: 16
},

我给.bottomSec设置了固定高度。由于数据是动态的,因此需要删除固定高度。请帮助

0 个答案:

没有答案