Browse Source

Test in useIsFocus

master
GabrielTrettel 3 years ago
parent
commit
2dde8259c1
  1. 9
      src/app/screens/RainSharingDataScreen.js

9
src/app/screens/RainSharingDataScreen.js

@ -16,6 +16,7 @@ import moment from "moment";
import FormDatePicker from "../components/forms/FormDatePicker";
import FormLocationPicker from "../components/forms/FormLocationPicker";
import { EventLocationContext } from "../context/EventLocationContext";
import {useIsFocused} from "@react-navigation/native";
const validationSchema = Yup.object().shape({
images: Yup.array(),
@ -25,6 +26,7 @@ const validationSchema = Yup.object().shape({
const borderWidth = 4;
function RainSharingDataScreen(props) {
const isFocused = useIsFocused();
const [rain, setRain] = useState(-1);
const [error, setError] = useState(false);
@ -39,6 +41,12 @@ function RainSharingDataScreen(props) {
context.defaultLocation();
}, []);
console.log(props.route)
useEffect(() => {
!isFocused &&
props.navigation.goBack();
}, [isFocused])
const location = context.eventCoordinates;
const address = context.eventLocation;
@ -62,7 +70,6 @@ function RainSharingDataScreen(props) {
type: "success",
onPress: () => { },
});
props.navigation.goBack();
props.navigation.navigate("Home");
}}
validationSchema={validationSchema}

Loading…
Cancel
Save