我正在使用react native中的react导航设置标签栏。我无法为选定/未选定状态设置多个标签栏图标。任何参考或文档会有所帮助吗?

最佳答案

tabBarIcon回调为您提供了针对变量。

static navigationOptions = {
    tabBarLabel: 'Home',
    tabBarIcon: ({ focused }) => {
        const image = focused
        ? require('../active.png')
        : require('../inactive.png')
        return (
            <Image
                source={image}
                style={styles.tabIcon}
            />
        )
    }
}

10-05 20:41
查看更多