Appsのprops構文整理
This commit is contained in:
parent
7781cf43e8
commit
85519cf857
92
Apps.js
92
Apps.js
@ -9,53 +9,47 @@ import { MenuPage } from "./MenuPage.js";
|
|||||||
import { useAreaInfo } from "./stateBox/useAreaInfo.js";
|
import { useAreaInfo } from "./stateBox/useAreaInfo.js";
|
||||||
import "./components/ActionSheetComponents/sheets.js";
|
import "./components/ActionSheetComponents/sheets.js";
|
||||||
|
|
||||||
const Tab = createBottomTabNavigator();
|
|
||||||
export function AppContainer() {
|
export function AppContainer() {
|
||||||
const { areaInfo, areaIconBadgeText } = useAreaInfo();
|
const Tab = createBottomTabNavigator();
|
||||||
const navigationRef = React.useRef();
|
const { areaInfo, areaIconBadgeText } = useAreaInfo();
|
||||||
return (
|
const navigationRef = React.useRef();
|
||||||
<NavigationContainer name="Root" style={{ flex: 1 }} ref={navigationRef}>
|
const getTabProps = (name, label, icon, iconFamily, tabBarBadge) => ({
|
||||||
<Tab.Navigator
|
name,
|
||||||
tabBarOptions={{ keyboardHidesTabBar: Platform.OS === "android" }}
|
options: {
|
||||||
initialRouteName="menuPage"
|
tabBarLabel: label,
|
||||||
lazy={false}
|
headerTransparent: true,
|
||||||
>
|
gestureEnabled: true,
|
||||||
<Tab.Screen
|
tabBarIcon: initIcon(icon, iconFamily),
|
||||||
name="login"
|
tabBarBadge,
|
||||||
options={{
|
},
|
||||||
tabBarLabel: "位置情報",
|
});
|
||||||
headerTransparent: true,
|
return (
|
||||||
gestureEnabled: true,
|
<NavigationContainer name="Root" style={{ flex: 1 }} ref={navigationRef}>
|
||||||
tabBarIcon: initIcon("barchart", "AntDesign"),
|
<Tab.Navigator
|
||||||
}}
|
tabBarOptions={{ keyboardHidesTabBar: Platform.OS === "android" }}
|
||||||
>
|
initialRouteName="menuPage"
|
||||||
{(props) => <Top {...props} navigationRef={navigationRef} />}
|
lazy={false}
|
||||||
</Tab.Screen>
|
>
|
||||||
<Tab.Screen
|
<Tab.Screen
|
||||||
name="menuPage"
|
{...getTabProps("login", "位置情報", "barchart", "AntDesign")}
|
||||||
options={{
|
children={(props) => <Top {...props} navigationRef={navigationRef} />}
|
||||||
tabBarLabel: "リンク",
|
/>
|
||||||
headerTransparent: true,
|
<Tab.Screen
|
||||||
gestureEnabled: true,
|
{...getTabProps("menuPage", "リンク", "radio", "Ionicons")}
|
||||||
tabBarIcon: initIcon("radio", "Ionicons"),
|
component={MenuPage}
|
||||||
}}
|
/>
|
||||||
component={MenuPage}
|
|
||||||
/>
|
<Tab.Screen
|
||||||
|
{...getTabProps(
|
||||||
<Tab.Screen
|
"home",
|
||||||
name="home"
|
"運行情報",
|
||||||
options={{
|
"train",
|
||||||
tabBarLabel: "運行情報",
|
"Ionicons",
|
||||||
headerTransparent: true,
|
areaInfo ? areaIconBadgeText : undefined
|
||||||
gestureEnabled: true,
|
)}
|
||||||
tabBarIcon: initIcon("train", "Ionicons"),
|
children={(props) => <TNDView {...props} />}
|
||||||
tabBarBadge: areaInfo ? areaIconBadgeText : undefined,
|
/>
|
||||||
}}
|
</Tab.Navigator>
|
||||||
>
|
</NavigationContainer>
|
||||||
{(props) => <TNDView {...props} />}
|
);
|
||||||
</Tab.Screen>
|
}
|
||||||
</Tab.Navigator>
|
|
||||||
</NavigationContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user