1

我正在使用来自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>

我在这里想念什么?

4

0 回答 0