我嘗試將全域樣式應用于 react-native 中的底部選項卡導航,但它不能在 screenOptions 道具中接受它。但是當我使用正常的行內樣式時它作業正常。請幫忙
export default function CustomBottomTab() {
return (
<Tab.Navigator
screenOptions={{
tabBarStyle: {styles.customTab} //underlines the dot as an error
}}
>
<Tab.Screen
name='Landing'
component={HomeScreen}
options={{
tabBarIcon: (props) => <AntDesign name='home' size={20} {...props} />,
}}
/>
<Tab.Screen
name='Notifications'
component={NotifScreen}
options={{
tabBarIcon: (props) => (
<FontAwesome5 name='bell' size={20} {...props} />
),
}}
/>
<Tab.Screen
name='Wishlist'
component={WishScreen}
options={{
tabBarIcon: (props) => (
<Ionicons name='bookmarks-outline' size={20} {...props} />
),
}}
/>
<Tab.Screen
name='Messages'
component={MessagesScreen}
options={{
tabBarIcon: (props) => (
<FontAwesome5 name='comment' size={20} {...props} />
),
}}
/>
</Tab.Navigator>
);
}
uj5u.com熱心網友回復:
{}從周圍洗掉{styles.customTab}。它不是有效的 JavaScript 語法。
它需要是:
tabBarStyle: styles.customTab
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/486053.html
上一篇:ReactNative,將語言環境引數從i18next傳遞到Axios組態檔會導致Invalidhookcall錯誤
