Browse Source

hiding tab bar in forms screens

master
analuizaff 4 years ago
parent
commit
35811b0629
  1. 9
      src/App.js
  2. 9
      src/app/navigation/AppNavigator.js
  3. 18
      src/app/navigation/RainSharingDataNavigator.js
  4. 19
      src/app/navigation/SharingDataNavigator.js
  5. 67
      src/app/navigation/SharingDataOptionsNavigator.js
  6. 4
      src/app/screens/PluviometerSharingDataScreen.js
  7. 68
      src/app/screens/SharingDataScreen.js

9
src/App.js

@ -2,21 +2,24 @@ import React from "react";
import { NavigationContainer } from "@react-navigation/native"; import { NavigationContainer } from "@react-navigation/native";
import navigationTheme from "./app/navigation/navigationTheme"; import navigationTheme from "./app/navigation/navigationTheme";
import AppNavigator from "./app/navigation/AppNavigator";
import "./app/config/globals.js"; import "./app/config/globals.js";
import openDatabase from "./app/database/database-connection"; import openDatabase from "./app/database/database-connection";
import initDatabase from "./app/database/database-init"; import initDatabase from "./app/database/database-init";
import FlashMessage from "react-native-flash-message"; import FlashMessage from "react-native-flash-message";
import { createStackNavigator } from '@react-navigation/stack';
import SharingDataOptionsNavigator from "./app/navigation/SharingDataOptionsNavigator";
export default function App() { export default function App() {
global.userDataBase = openDatabase(); global.userDataBase = openDatabase();
initDatabase(global.userDataBase); initDatabase(global.userDataBase);
const Stack = createStackNavigator();
return ( return (
<NavigationContainer theme={navigationTheme}> <NavigationContainer theme={navigationTheme}>
<AppNavigator />
<FlashMessage position="top" /> <FlashMessage position="top" />
<Stack.Navigator>
<Stack.Screen name="Home" component={SharingDataOptionsNavigator} options={{headerShown: false}}/>
</Stack.Navigator>
</NavigationContainer> </NavigationContainer>
); );
} }

9
src/app/navigation/AppNavigator.js

@ -6,9 +6,9 @@ import AccountNavigator from "./AccountNavigator";
import FeedNavigator from "./FeedNavigator"; import FeedNavigator from "./FeedNavigator";
import MessagesNavigator from "./MessagesNavigator"; import MessagesNavigator from "./MessagesNavigator";
import OfficialMessagesNavigator from "./OfficialMessagesNavigator"; import OfficialMessagesNavigator from "./OfficialMessagesNavigator";
import SharingDataScreen from "../screens/SharingDataScreen";
import NewListingButton from "./NewListingButton"; import NewListingButton from "./NewListingButton";
import routes from "./routes"; import routes from "./routes";
import SharingDataNavigator from "./SharingDataNavigator";
const Tab = createBottomTabNavigator(); const Tab = createBottomTabNavigator();
@ -39,11 +39,14 @@ const AppNavigator = () => (
<Tab.Screen <Tab.Screen
name="SharingData" name="SharingData"
component={SharingDataScreen}
component={SharingDataNavigator}
options={({ navigation }) => ({ options={({ navigation }) => ({
tabBarButton: () => ( tabBarButton: () => (
<NewListingButton <NewListingButton
onPress={() => navigation.navigate(routes.SHARING_DATA)}
onPress={() =>
//navigation.goBack(null)
navigation.navigate(routes.SHARING_DATA)}
/> />
), ),
tabBarIcon: ({ color, size }) => ( tabBarIcon: ({ color, size }) => (

18
src/app/navigation/RainSharingDataNavigator.js

@ -1,18 +0,0 @@
import { NavigationContainer } from '@react-navigation/native';
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View, YellowBox } from 'react-native';
import { createStackNavigator } from "@react-navigation/stack";
import RainSharingDataScreen from '../screens/RainSharingDataScreen';
import SharingDataScreen from '../screens/SharingDataScreen';
const Stack = createStackNavigator();
function RainSharingDataNavigator() {
return (
<Stack.Navigator>
<Stack.Screen name="RainSharingData" component={RainSharingDataScreen} />
</Stack.Navigator>
);
}
export default RainSharingDataNavigator;

19
src/app/navigation/SharingDataNavigator.js

@ -0,0 +1,19 @@
import React from "react";
import { createStackNavigator } from "@react-navigation/stack";
import SharingDataScreen from "../screens/SharingDataScreen";
const Stack = createStackNavigator();
const SharingDataNavigator = () => (
<Stack.Navigator>
<Stack.Screen name="Enviar uma informação" component={SharingDataScreen}
options={{
title: "Enviar uma informação",
headerStyle: {
backgroundColor: "lightgray",
},
}} />
</Stack.Navigator>
);
export default SharingDataNavigator;

67
src/app/navigation/SharingDataOptionsNavigator.js

@ -0,0 +1,67 @@
import React from 'react';
import { createStackNavigator } from "@react-navigation/stack";
import AppNavigator from './AppNavigator';
import RainSharingDataScreen from '../screens/RainSharingDataScreen';
import RiverFloodSharingDataScreen from '../screens/RiverFloodSharingDataScreen';
import SharingFloodZonesScreen from '../screens/SharingFloodZonesScreen';
import PluviometerSharingDataScreen from '../screens/PluviometerSharingDataScreen';
const Stack = createStackNavigator();
function SharingDataOptionsNavigator() {
return (
<Stack.Navigator initialRouteName="SharingData">
<Stack.Screen
name="nãoqueromais"
component={AppNavigator}
options={{
headerShown: false
}}
/>
<Stack.Screen
name="RainSharingData"
component={RainSharingDataScreen}
options={{
title: "Enviar uma informação",
headerStyle: {
backgroundColor: "lightgray",
},
}}
/>
<Stack.Screen
name="FloodSharingData"
component={SharingFloodZonesScreen}
options={{
title: "Enviar uma informação",
headerStyle: {
backgroundColor: "lightgray",
},
}}
/>
<Stack.Screen
name="PluviometerSharingData"
component={PluviometerSharingDataScreen}
options={{
title: "Enviar uma informação",
headerStyle: {
backgroundColor: "lightgray",
},
}}
/>
<Stack.Screen
name="RiverFloodData"
component={RiverFloodSharingDataScreen}
options={{
title: "Enviar uma informação",
headerStyle: {
backgroundColor: "lightgray",
},
}}
/>
</Stack.Navigator>
);
}
export default SharingDataOptionsNavigator;

4
src/app/screens/PluviometerSharingDataScreen.js

@ -23,7 +23,7 @@ import colors from "../config/colors";
const validationSchema = Yup.object().shape({ const validationSchema = Yup.object().shape({
pluviometer: Yup.number().required("Campo obrigatório").min(0, "O valor deve ser maior ou igual a 0.").max(10000).label("pluviometer"), pluviometer: Yup.number().required("Campo obrigatório").min(0, "O valor deve ser maior ou igual a 0.").max(10000).label("pluviometer"),
data: Yup.string().min(1, "Por favor preencha a data"), data: Yup.string().min(1, "Por favor preencha a data"),
images: Yup.array().min(1, "Por favor, selecione uma imagem."),
images: Yup.array(),
}); });
function PluviometerSharingDataScreen(props) { function PluviometerSharingDataScreen(props) {
@ -94,7 +94,7 @@ function PluviometerSharingDataScreen(props) {
insertPluviometerData({ ...values, dateTime, location }); insertPluviometerData({ ...values, dateTime, location });
showMessage({ showMessage({
message: "Informação enviada!", message: "Informação enviada!",
duration: 1950,
duration: 3000,
icon: "success", icon: "success",
type: "success", type: "success",
}); });

68
src/app/screens/SharingDataScreen.js

@ -2,12 +2,7 @@ import React from "react";
import { StyleSheet, View } from "react-native"; import { StyleSheet, View } from "react-native";
import { Image, Text, TouchableOpacity } from "react-native"; import { Image, Text, TouchableOpacity } from "react-native";
import { createStackNavigator } from "@react-navigation/stack";
import RainSharingDataScreen from "../screens/RainSharingDataScreen";
import SharingFloodZonesScreen from "./SharingFloodZonesScreen";
import PluviometerSharingDataScreen from "./PluviometerSharingDataScreen";
import RiverFloodSharingDataScreen from "./RiverFloodSharingDataScreen";
import assets from "../config/assets";
import assets from "../config/assets"
//1/3 //1/3
function SharingDataScreen({ navigation }) { function SharingDataScreen({ navigation }) {
@ -79,65 +74,8 @@ const styles = StyleSheet.create({
}, },
}); });
const Stack = createStackNavigator();
function RainSharingDataNavigator() {
return (
<Stack.Navigator initialRouteName="SharingData">
<Stack.Screen
name="SharingData"
component={SharingDataScreen}
options={{
title: "Enviar uma informação",
headerStyle: {
backgroundColor: "lightgray",
},
headerTitleStyle: { alignSelf: "center" },
}}
/>
<Stack.Screen
name="RainSharingData"
component={RainSharingDataScreen}
options={{
title: "Enviar uma informação",
headerStyle: {
backgroundColor: "lightgray",
},
}}
/>
<Stack.Screen
name="FloodSharingData"
component={SharingFloodZonesScreen}
options={{
title: "Enviar uma informação",
headerStyle: {
backgroundColor: "lightgray",
},
}}
/>
<Stack.Screen
name="PluviometerSharingData"
component={PluviometerSharingDataScreen}
options={{
title: "Enviar uma informação",
headerStyle: {
backgroundColor: "lightgray",
},
}}
/>
<Stack.Screen
name="RiverFloodData"
component={RiverFloodSharingDataScreen}
options={{
title: "Enviar uma informação",
headerStyle: {
backgroundColor: "lightgray",
},
}}
/>
</Stack.Navigator>
);
}
export default RainSharingDataNavigator;
export default SharingDataScreen;
Loading…
Cancel
Save