无法滚动TabViewAnimated视图

时间:2019-06-30 07:24:30

标签: react-native react-native-tab-view

我正在使用 react-native-tab-view 中的 TabViewAnimated 和三个场景。加载时会显示子场景的滚动条,但很快就会消失,并显示不滚动的TabViewAnimated滚动。

我的渲染函数如下:

render() {
  return (
    <View style={{backgroundColor: "#fff"}}>
    <StickyHeaderFooterScrollView makeScrollable={true} 
      renderStickyHeader={() => (
        <View>
          <Text> My Title </Text>
        </View>
      )}
    >
      <View style={{backgroundColor: "#fff", height: Dimensions.get('window').height, flex: 1}}>
        <TabViewAnimated
          navigationState={this.state}
          renderScene={this._renderScene}
          animationEnabled={true}
          swipeEnabled={true}
          renderHeader={this._renderHeader}
          onIndexChange={index => this.setState({ index })}
          initialLayout={initialLayout}
        />
      </View>
    </StickyHeaderFooterScrollView>
  </View>
  );
}

initailLayout 值:     const initialLayout = {       高度:0,       宽度:Dimensions.get('window')。width,      };

并且_renderScene函数是

renderScene = ({ route }) => {
  let auth = this.props.navigation.state.params.auth;
  switch (route.key) {
    case 'tab1':
      return <Tabs1 />;
    case 'tab2':
      return <Tab2 />;
    case 'tab3':
      return <Tab3 />;
    default:
      return null;
  }
};

子场景标签就像

<View style={{flex: 1, backgroundColor:"#EEE"}}>
  <View style={{margin:'3%'}}>
    <FlatList
      vertical
      data={data}
      renderItem={({ item: rowData }) => {
        return (
          <View >
            <View style={{width: "20%"}}>
              <Image source={{uri: rowData.photo}} />
            </View>
            <View style={{width: "60%"}}>
              <Text> {rowData.name} </Text>
            </View>
            <View style={{width: "20%"}}>
              <Text> {rowData.mail} </Text>
            </View>
          </View>
        );
      }}
      showsHorizontalScrollIndicator={false}
      keyExtractor={(item, index) => index.toString()}
    /> 
  </View>
</View>

我在这里想念什么?

0 个答案:

没有答案