React Native:如何在 android 的标签栏中添加图标



我想在 android 的 tabView 中添加图标。我的代码看起来:

<ScrollableTabView>
            <View style={styles.container} tabLabel='Menu Button'>
            </View>
            <View style={styles.container} tabLabel='My App'>
            </View>         
            <View style={styles.container} tabLabel='Settings'>
            </View>  
</ScrollableTabView>

我想要图标而不是菜单按钮设置。如何使用图标而不是标签标签?

我假设你正在使用:https://github.com/skv-headless/react-native-scrollable-tab-view

此解决方案应该有效:

<ScrollableTabView>
    <View style={styles.container} tabLabel='android-menu'>
    </View>
    <View style={styles.container} tabLabel='My App'>
    </View>         
    <View style={styles.container} tabLabel='android-settings'>
    </View>  
</ScrollableTabView>

完整的图标列表可在此处找到:

https://github.com/skv-headless/react-native-scrollable-tab-view/blob/ee5d99950fad9c4c1129d029d7bfaea130df72d1/examples/FacebookTabsExample/android/app/src/main/assets/ion.json

编辑 1:

此示例演示要在 tabLabel 上使用的图标,而不是文本:https://github.com/skv-headless/react-native-scrollable-tab-view/tree/master/examples/FacebookTabsExample

最新更新