Files
jrshikoku/components/Apps/NewMenu.tsx

97 lines
3.1 KiB
TypeScript

import React from "react";
import { View, Text, TouchableOpacity, useWindowDimensions, Platform } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { useThemeColors } from "@/lib/theme";
import * as Updates from "expo-updates";
import Constants from "expo-constants";
import { useCurrentTrain } from "../../stateBox/useCurrentTrain";
import { useTrainMenu } from "../../stateBox/useTrainMenu";
import { useSafeAreaInsets } from "react-native-safe-area-context";
export const NewMenu = () => {
const { fixed } = useThemeColors();
const { webview } = useCurrentTrain();
const { width } = useWindowDimensions();
const { LoadError } = useTrainMenu();
const { top } = useSafeAreaInsets();
return (
<View
style={{
position: "absolute",
top,
width,
height: 54,
backgroundColor: fixed.primary,
borderColor: fixed.textOnPrimary,
borderStyle: "solid",
borderWidth: 1,
alignContent: "center",
alignSelf: "center",
alignItems: "center",
flexDirection: "row",
}}
>
<TouchableOpacity
activeOpacity={1}
style={{
flex: 1,
height: 54,
backgroundColor: fixed.primary,
borderColor: fixed.textOnPrimary,
borderStyle: "solid",
borderWidth: 1,
borderRightWidth: 0,
alignContent: "center",
alignSelf: "center",
alignItems: "center",
flexDirection: "row",
}}
onPress={() => {
webview.current?.injectJavaScript(`AccordionClassEvent()`);
}}
>
<>
<View
style={{
width: 54,
height: 54,
backgroundColor: fixed.primary,
borderColor: fixed.textOnPrimary,
borderStyle: "solid",
borderWidth: 1,
alignContent: "center",
alignSelf: "center",
alignItems: "center",
}}
>
<View style={{ flex: 1 }} />
<Ionicons name="menu" color={fixed.textOnPrimary} size={30} />
<View style={{ flex: 1 }} />
</View>
<View style={{ flex: 1 }} />
<Text style={{ color: fixed.textOnPrimary, fontSize: 20 }}></Text>
<View style={{ flex: 1 }}></View>
</>
</TouchableOpacity>
<TouchableOpacity
onPress={() => Updates.reloadAsync()}
style={{
width: 54,
height: 54,
backgroundColor: LoadError ? "red" : fixed.primary,
borderColor: fixed.textOnPrimary,
borderStyle: "solid",
borderWidth: 1,
alignContent: "center",
alignSelf: "center",
alignItems: "center",
}}
>
<View style={{ flex: 1 }} />
<Ionicons name="reload" color={fixed.textOnPrimary} size={30} />
<View style={{ flex: 1 }} />
</TouchableOpacity>
</View>
);
};