使用FlatList在React-Native Nativebase选项卡中显示选项卡

问题描述 投票:0回答:1

我正在尝试遍历数据源并基于该数据源显示Tabs,并且我正在为此使用FlatList,这是代码

<Tabs
   renderTabBar={() => <ScrollableTab />}
   tabBarUnderlineStyle={{backgroundColor: "#4285f4"}}
   tabBarBackgroundColor="#fff"
>
    <FlatList
        data={this.state.dataSource}
        renderItem={({item}) =>
            <Tab
               heading={item.title}
            >
                <Text>Tab details</Text>
            </Tab>
    />
</Tabs>

这总是给我一个错误的说法

undefined is not an object (evaluating 'child.props.heading.props') the error is located at ScrollableTabView

我不知道我尝试使用map而不是FlatList出了什么问题,并且工作正常

react-native tabs react-native-flatlist native-base
1个回答
0
投票

您必须用]替换本机基本选项卡组件>

https://github.com/ptomasroos/react-native-scrollable-tab-view/blob/master/README.md

无需使用Flatlist作为子组件以获得更好的性能,它将无法正常工作。

© www.soinside.com 2019 - 2024. All rights reserved.