Add media add to header.
This commit is contained in:
@@ -4,9 +4,12 @@ import { NavigationContainer } from "@react-navigation/native";
|
||||
import { createStackNavigator } from "@react-navigation/stack";
|
||||
import i18n from "i18next";
|
||||
import React, { useEffect } from "react";
|
||||
import { Button } from "react-native-paper";
|
||||
import { SafeAreaView } from "react-native-safe-area-context";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import { setCameraJob, setCameraJobId } from "../../redux/app/app.actions";
|
||||
import {
|
||||
checkUserSession,
|
||||
emailSignInStart,
|
||||
@@ -38,9 +41,14 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
emailSignInStart: (email, password) =>
|
||||
dispatch(emailSignInStart({ email, password })),
|
||||
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.Screen
|
||||
name="JobList"
|
||||
@@ -52,14 +60,27 @@ const JobStackNavigator = () => (
|
||||
<JobStack.Screen
|
||||
name="JobDetail"
|
||||
component={ScreenJobDetail}
|
||||
options={({ route }) => ({
|
||||
options={({ navigation, route }) => ({
|
||||
title:
|
||||
(route.params && route.params.title) ||
|
||||
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>
|
||||
);
|
||||
));
|
||||
|
||||
const MediaBrowserStackNavigator = () => (
|
||||
<MediaBrowserStack.Navigator initialRouteName="MediaBrowser">
|
||||
|
||||
Reference in New Issue
Block a user