From 36e5bc0e1d88e8975d68939f1d4ff734bdb483b7 Mon Sep 17 00:00:00 2001 From: RobTS Date: Mon, 13 Apr 2020 15:04:01 +0200 Subject: [PATCH] Initial commit with basic maps implementation. --- App.js | 15 ++++++++++++++- android/app/src/main/AndroidManifest.xml | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/App.js b/App.js index 800d044..c39556b 100644 --- a/App.js +++ b/App.js @@ -18,18 +18,30 @@ import MapView, {Marker, PROVIDER_GOOGLE} from 'react-native-maps'; const App: () => React$Node = () => { const setMapRef = useRef(); + const setTracksViewRef = useRef(); + const [mapVisible, setMapVisible] = useState(true); + const [tracksViewChanges, setTracksViewChanges] = useState(true); + setMapRef.current = setMapVisible; + setTracksViewRef.current = setTracksViewChanges; + const onTemporaryRemove = () => { if (!mapVisible) { return; } setMapRef.current(false); setTimeout(() => { + setTracksViewRef.current(true); setMapRef.current(true); }, 2000); }; + const asyncChange = () => + setTimeout(() => { + setTracksViewRef.current(false); + }, 3000); + return ( <> @@ -52,7 +64,8 @@ const App: () => React$Node = () => { latitude: 37.806173, longitude: -122.446875, }} - tracksViewChanges={false} + ref={asyncChange} + tracksViewChanges={tracksViewChanges} /> ) : ( diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 67e28c3..fe4efda 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -22,6 +22,9 @@ +