Fix up main screen navigation.
This commit is contained in:
11
App.js
11
App.js
@@ -4,12 +4,7 @@ import AppLoading from "expo-app-loading";
|
|||||||
import * as FileSystem from "expo-file-system";
|
import * as FileSystem from "expo-file-system";
|
||||||
import * as Font from "expo-font";
|
import * as Font from "expo-font";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {
|
import { StatusBar as rnStatusBar, StyleSheet } from "react-native";
|
||||||
SafeAreaView,
|
|
||||||
StatusBar as rnStatusBar,
|
|
||||||
StyleSheet,
|
|
||||||
} from "react-native";
|
|
||||||
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
||||||
import { Provider } from "react-redux";
|
import { Provider } from "react-redux";
|
||||||
import { PersistGate } from "redux-persist/integration/react";
|
import { PersistGate } from "redux-persist/integration/react";
|
||||||
import * as Sentry from "sentry-expo";
|
import * as Sentry from "sentry-expo";
|
||||||
@@ -60,9 +55,7 @@ export default class App extends React.Component {
|
|||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<PersistGate persistor={persistor}>
|
<PersistGate persistor={persistor}>
|
||||||
<ApolloProvider client={client}>
|
<ApolloProvider client={client}>
|
||||||
<SafeAreaView style={{ flex: 1, backgroundColor: "dodgerblue" }}>
|
<ScreenMainComponent />
|
||||||
<ScreenMainComponent />
|
|
||||||
</SafeAreaView>
|
|
||||||
</ApolloProvider>
|
</ApolloProvider>
|
||||||
</PersistGate>
|
</PersistGate>
|
||||||
</Provider>
|
</Provider>
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { Ionicons } from "@expo/vector-icons";
|
|
||||||
import { useFocusEffect, useNavigation } from "@react-navigation/native";
|
import { useFocusEffect, useNavigation } from "@react-navigation/native";
|
||||||
import { Camera } from "expo-camera";
|
import { Camera } from "expo-camera";
|
||||||
import * as FileSystem from "expo-file-system";
|
import * as FileSystem from "expo-file-system";
|
||||||
import React, { useEffect, useRef, useState } from "react";
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
import { SafeAreaView, Text, TouchableOpacity, View } from "react-native";
|
import { SafeAreaView, Text, View } from "react-native";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import {
|
import {
|
||||||
@@ -131,9 +130,7 @@ export function ScreenCamera({ cameraJobId, cameraJob, addPhoto }) {
|
|||||||
const { flashMode, cameraType, capturing } = state;
|
const { flashMode, cameraType, capturing } = state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView
|
<SafeAreaView style={{ display: "flex", flex: 1 }}>
|
||||||
style={{ display: "flex", flex: 1, backgroundColor: "tomato" }}
|
|
||||||
>
|
|
||||||
<Camera
|
<Camera
|
||||||
style={{ flex: 1, display: "flex" }}
|
style={{ flex: 1, display: "flex" }}
|
||||||
type={state.cameraType}
|
type={state.cameraType}
|
||||||
@@ -146,22 +143,6 @@ export function ScreenCamera({ cameraJobId, cameraJob, addPhoto }) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CameraSelectJob />
|
<CameraSelectJob />
|
||||||
<TouchableOpacity
|
|
||||||
onPress={() => {
|
|
||||||
navigation.push("MediaCache");
|
|
||||||
}}
|
|
||||||
style={{
|
|
||||||
alignSelf: "flex-start",
|
|
||||||
alignItems: "center",
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: "bold",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Ionicons
|
|
||||||
name="ios-photos"
|
|
||||||
style={{ color: "#fff", fontSize: 40 }}
|
|
||||||
/>
|
|
||||||
</TouchableOpacity>
|
|
||||||
|
|
||||||
<CameraControls
|
<CameraControls
|
||||||
capturing={capturing}
|
capturing={capturing}
|
||||||
|
|||||||
@@ -3,11 +3,9 @@ import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
|
|||||||
import { createDrawerNavigator } from "@react-navigation/drawer";
|
import { createDrawerNavigator } from "@react-navigation/drawer";
|
||||||
import { NavigationContainer } from "@react-navigation/native";
|
import { NavigationContainer } from "@react-navigation/native";
|
||||||
import { createStackNavigator } from "@react-navigation/stack";
|
import { createStackNavigator } from "@react-navigation/stack";
|
||||||
import Dinero from "dinero.js";
|
|
||||||
import i18n from "i18next";
|
import i18n from "i18next";
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { StatusBar as rnStatusBar, StyleSheet } from "react-native";
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import {
|
import {
|
||||||
@@ -33,6 +31,7 @@ const JobStack = createStackNavigator();
|
|||||||
const CameraStack = createStackNavigator();
|
const CameraStack = createStackNavigator();
|
||||||
const MessagingStack = createStackNavigator();
|
const MessagingStack = createStackNavigator();
|
||||||
const MediaCacheStack = createStackNavigator();
|
const MediaCacheStack = createStackNavigator();
|
||||||
|
const MoreStack = createStackNavigator();
|
||||||
const BottomTabs = createBottomTabNavigator();
|
const BottomTabs = createBottomTabNavigator();
|
||||||
const Drawer = createDrawerNavigator();
|
const Drawer = createDrawerNavigator();
|
||||||
|
|
||||||
@@ -48,26 +47,12 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
signOutStart: () => dispatch(signOutStart()),
|
signOutStart: () => dispatch(signOutStart()),
|
||||||
});
|
});
|
||||||
|
|
||||||
Dinero.globalLocale = "en-CA";
|
|
||||||
|
|
||||||
const LeftDrawerButton = (props, navigation) => (
|
|
||||||
<Ionicons
|
|
||||||
{...props}
|
|
||||||
name="ios-menu"
|
|
||||||
size={24}
|
|
||||||
color="dodgerblue"
|
|
||||||
style={{ marginLeft: 20 }}
|
|
||||||
onPress={() => navigation.toggleDrawer()}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
||||||
const JobStackNavigator = ({ navigation }) => (
|
const JobStackNavigator = ({ navigation }) => (
|
||||||
<JobStack.Navigator initialRouteName="JobList">
|
<JobStack.Navigator initialRouteName="JobList">
|
||||||
<JobStack.Screen
|
<JobStack.Screen
|
||||||
name="JobList"
|
name="JobList"
|
||||||
options={({ route }) => ({
|
options={({ route }) => ({
|
||||||
title: `${i18n.t("joblist.labels.activejobs")}`,
|
title: `${i18n.t("joblist.labels.activejobs")}`,
|
||||||
headerLeft: (props) => LeftDrawerButton(props, navigation),
|
|
||||||
})}
|
})}
|
||||||
component={ScreenJobList}
|
component={ScreenJobList}
|
||||||
/>
|
/>
|
||||||
@@ -90,23 +75,17 @@ const CameraStackNavigator = ({ navigation }) => (
|
|||||||
options={{ headerShown: false }}
|
options={{ headerShown: false }}
|
||||||
component={ScreenCamera}
|
component={ScreenCamera}
|
||||||
/>
|
/>
|
||||||
{/* <CameraStack.Screen
|
|
||||||
name="CameraJobSearch"
|
|
||||||
component={ScreenCameraJobSearch}
|
|
||||||
/> */}
|
|
||||||
|
|
||||||
<CameraStack.Screen name="MediaCache" component={ScreenMediaCache} />
|
|
||||||
</CameraStack.Navigator>
|
</CameraStack.Navigator>
|
||||||
);
|
);
|
||||||
|
|
||||||
const MediaCacheStackNavigator = ({ navigation }) => (
|
const MediaCacheStackNavigator = ({ navigation }) => (
|
||||||
<CameraStack.Navigator initialRouteName="TabMediaCache">
|
<MediaCacheStack.Navigator initialRouteName="TabMediaCache">
|
||||||
<CameraStack.Screen
|
<MediaCacheStack.Screen
|
||||||
name="MediaCache"
|
name="MediaCache"
|
||||||
options={{ title: i18n.t("mediacache.titles.mediacachetab") }}
|
options={{ title: i18n.t("mediacache.titles.mediacachetab") }}
|
||||||
component={ScreenMediaCache}
|
component={ScreenMediaCache}
|
||||||
/>
|
/>
|
||||||
</CameraStack.Navigator>
|
</MediaCacheStack.Navigator>
|
||||||
);
|
);
|
||||||
|
|
||||||
const MessagingStackNavigator = ({ navigation }) => (
|
const MessagingStackNavigator = ({ navigation }) => (
|
||||||
@@ -121,6 +100,17 @@ const MessagingStackNavigator = ({ navigation }) => (
|
|||||||
/>
|
/>
|
||||||
</MessagingStack.Navigator>
|
</MessagingStack.Navigator>
|
||||||
);
|
);
|
||||||
|
const MoreStackNavigator = ({ navigation }) => (
|
||||||
|
<MoreStack.Navigator>
|
||||||
|
<MoreStack.Screen
|
||||||
|
name="Settings"
|
||||||
|
options={{
|
||||||
|
title: i18n.t("settings.titles.settings"),
|
||||||
|
}}
|
||||||
|
component={ScreenSettingsComponent}
|
||||||
|
/>
|
||||||
|
</MoreStack.Navigator>
|
||||||
|
);
|
||||||
|
|
||||||
const BottomTabsNavigator = () => (
|
const BottomTabsNavigator = () => (
|
||||||
<BottomTabs.Navigator
|
<BottomTabs.Navigator
|
||||||
@@ -162,27 +152,17 @@ const BottomTabsNavigator = () => (
|
|||||||
options={{ title: i18n.t("mediacache.titles.mediacachetab") }}
|
options={{ title: i18n.t("mediacache.titles.mediacachetab") }}
|
||||||
component={MediaCacheStackNavigator}
|
component={MediaCacheStackNavigator}
|
||||||
/>
|
/>
|
||||||
{
|
<BottomTabs.Screen
|
||||||
// <BottomTabs.Screen
|
name="MessagingTab"
|
||||||
// name="MessagingTab"
|
options={{ title: i18n.t("messaging.titles.messagingtab") }}
|
||||||
// options={{ title: i18n.t("messaging.titles.messagingtab") }}
|
component={MessagingStackNavigator}
|
||||||
// component={MessagingStackNavigator}
|
|
||||||
// />
|
|
||||||
}
|
|
||||||
</BottomTabs.Navigator>
|
|
||||||
);
|
|
||||||
|
|
||||||
const DrawerNavigator = ({ navigation }) => (
|
|
||||||
<Drawer.Navigator>
|
|
||||||
<Drawer.Screen name="Home" component={BottomTabsNavigator} />
|
|
||||||
<Drawer.Screen
|
|
||||||
name="Settings"
|
|
||||||
options={{
|
|
||||||
title: i18n.t("settings.titles.settings"),
|
|
||||||
}}
|
|
||||||
component={ScreenSettingsComponent}
|
|
||||||
/>
|
/>
|
||||||
</Drawer.Navigator>
|
<BottomTabs.Screen
|
||||||
|
name="MoreTab"
|
||||||
|
options={{ title: i18n.t("more.titles.moretab") }}
|
||||||
|
component={MoreStackNavigator}
|
||||||
|
/>
|
||||||
|
</BottomTabs.Navigator>
|
||||||
);
|
);
|
||||||
|
|
||||||
export function ScreenMainComponent({
|
export function ScreenMainComponent({
|
||||||
@@ -202,7 +182,7 @@ export function ScreenMainComponent({
|
|||||||
<ScreenSplash />
|
<ScreenSplash />
|
||||||
) : currentUser.authorized ? (
|
) : currentUser.authorized ? (
|
||||||
bodyshop ? (
|
bodyshop ? (
|
||||||
<DrawerNavigator />
|
<BottomTabsNavigator />
|
||||||
) : (
|
) : (
|
||||||
<ScreenSplash />
|
<ScreenSplash />
|
||||||
)
|
)
|
||||||
@@ -216,13 +196,3 @@ export default connect(
|
|||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(ScreenMainComponent);
|
)(ScreenMainComponent);
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
container: {
|
|
||||||
flex: 1,
|
|
||||||
backgroundColor: "#fff",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
paddingTop: Platform.OS === "android" ? rnStatusBar.currentHeight : 0,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|||||||
Reference in New Issue
Block a user