Add media add to header.
This commit is contained in:
@@ -52,6 +52,7 @@ export function JobListItem({ setCameraJob, setCameraJobId, item }) {
|
|||||||
navigation.push("JobDetail", {
|
navigation.push("JobDetail", {
|
||||||
jobId: item.id,
|
jobId: item.id,
|
||||||
title: item.ro_number || t("general.labels.na"),
|
title: item.ro_number || t("general.labels.na"),
|
||||||
|
job: item,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ import { NavigationContainer } from "@react-navigation/native";
|
|||||||
import { createStackNavigator } from "@react-navigation/stack";
|
import { createStackNavigator } from "@react-navigation/stack";
|
||||||
import i18n from "i18next";
|
import i18n from "i18next";
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
|
import { Button } from "react-native-paper";
|
||||||
import { SafeAreaView } from "react-native-safe-area-context";
|
import { SafeAreaView } from "react-native-safe-area-context";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
|
import { setCameraJob, setCameraJobId } from "../../redux/app/app.actions";
|
||||||
import {
|
import {
|
||||||
checkUserSession,
|
checkUserSession,
|
||||||
emailSignInStart,
|
emailSignInStart,
|
||||||
@@ -38,9 +41,14 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
emailSignInStart: (email, password) =>
|
emailSignInStart: (email, password) =>
|
||||||
dispatch(emailSignInStart({ email, password })),
|
dispatch(emailSignInStart({ email, password })),
|
||||||
signOutStart: () => dispatch(signOutStart()),
|
signOutStart: () => dispatch(signOutStart()),
|
||||||
|
setCameraJobId: (id) => dispatch(setCameraJobId(id)),
|
||||||
|
setCameraJob: (job) => dispatch(setCameraJob(job)),
|
||||||
});
|
});
|
||||||
|
|
||||||
const JobStackNavigator = () => (
|
const JobStackNavigator = connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(({ setCameraJobId, setCameraJob }) => (
|
||||||
<JobStack.Navigator initialRouteName="JobList">
|
<JobStack.Navigator initialRouteName="JobList">
|
||||||
<JobStack.Screen
|
<JobStack.Screen
|
||||||
name="JobList"
|
name="JobList"
|
||||||
@@ -52,14 +60,27 @@ const JobStackNavigator = () => (
|
|||||||
<JobStack.Screen
|
<JobStack.Screen
|
||||||
name="JobDetail"
|
name="JobDetail"
|
||||||
component={ScreenJobDetail}
|
component={ScreenJobDetail}
|
||||||
options={({ route }) => ({
|
options={({ navigation, route }) => ({
|
||||||
title:
|
title:
|
||||||
(route.params && route.params.title) ||
|
(route.params && route.params.title) ||
|
||||||
i18n.t("joblist.labels.detail"),
|
i18n.t("joblist.labels.detail"),
|
||||||
|
// eslint-disable-next-line react/display-name
|
||||||
|
headerRight: () => (
|
||||||
|
<Button
|
||||||
|
onPress={() => {
|
||||||
|
logImEXEvent("imexmobile_setcamerajobid_swipe");
|
||||||
|
setCameraJobId(route.params.jobId);
|
||||||
|
setCameraJob(route.params.job);
|
||||||
|
navigation.navigate("MediaBrowserTab");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Ionicons name="ios-add" size={32} color="dodgerblue" />
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
</JobStack.Navigator>
|
</JobStack.Navigator>
|
||||||
);
|
));
|
||||||
|
|
||||||
const MediaBrowserStackNavigator = () => (
|
const MediaBrowserStackNavigator = () => (
|
||||||
<MediaBrowserStack.Navigator initialRouteName="MediaBrowser">
|
<MediaBrowserStack.Navigator initialRouteName="MediaBrowser">
|
||||||
|
|||||||
Reference in New Issue
Block a user