File tree Expand file tree Collapse file tree 4 files changed +16
-8
lines changed
android/src/main/java/com/google/android/react/navsdk Expand file tree Collapse file tree 4 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ public void onRecenterButtonClick() {
113113
114114 @ Override
115115 public void onMarkerClick (Marker marker ) {
116- emitEvent ("onMapReady " , ObjectTranslationUtil .getMapFromMarker (marker ));
116+ emitEvent ("onMarkerClick " , ObjectTranslationUtil .getMapFromMarker (marker ));
117117 }
118118
119119 @ Override
@@ -138,7 +138,7 @@ public void onGroundOverlayClick(GroundOverlay groundOverlay) {
138138
139139 @ Override
140140 public void onMarkerInfoWindowTapped (Marker marker ) {
141- emitEvent ("onInfoWindowClick " , ObjectTranslationUtil .getMapFromMarker (marker ));
141+ emitEvent ("onMarkerInfoWindowTapped " , ObjectTranslationUtil .getMapFromMarker (marker ));
142142 }
143143
144144 @ Override
Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ public void onRecenterButtonClick() {
125125
126126 @ Override
127127 public void onMarkerClick (Marker marker ) {
128- emitEvent ("onMapReady " , ObjectTranslationUtil .getMapFromMarker (marker ));
128+ emitEvent ("onMarkerClick " , ObjectTranslationUtil .getMapFromMarker (marker ));
129129 }
130130
131131 @ Override
@@ -150,7 +150,7 @@ public void onGroundOverlayClick(GroundOverlay groundOverlay) {
150150
151151 @ Override
152152 public void onMarkerInfoWindowTapped (Marker marker ) {
153- emitEvent ("onInfoWindowClick " , ObjectTranslationUtil .getMapFromMarker (marker ));
153+ emitEvent ("onMarkerInfoWindowTapped " , ObjectTranslationUtil .getMapFromMarker (marker ));
154154 }
155155
156156 @ Override
Original file line number Diff line number Diff line change 1717import * as React from 'react' ;
1818import {
1919 NavigationContainer ,
20+ useIsFocused ,
2021 useNavigation ,
2122 type NavigationProp ,
2223} from '@react-navigation/native' ;
@@ -37,15 +38,20 @@ export type StackNavigation = NavigationProp<RootStackParamList>;
3738
3839const HomeScreen = ( ) => {
3940 const { navigate } = useNavigation < StackNavigation > ( ) ;
41+ const isFocused = useIsFocused ( ) ;
42+
4043 return (
4144 < View style = { styles . container } >
4245 < View style = { styles . buttonContainer } >
43- < Button title = "Navigation" onPress = { ( ) => navigate ( 'Navigation' ) } />
46+ < Button
47+ title = "Navigation"
48+ onPress = { ( ) => isFocused && navigate ( 'Navigation' ) }
49+ />
4450 </ View >
4551 < View style = { styles . buttonContainer } >
4652 < Button
4753 title = "Multiple Maps"
48- onPress = { ( ) => navigate ( 'Multiple maps' ) }
54+ onPress = { ( ) => isFocused && navigate ( 'Multiple maps' ) }
4955 />
5056 </ View >
5157 </ View >
Original file line number Diff line number Diff line change @@ -258,7 +258,6 @@ const NavigationScreen = () => {
258258 useEffect ( ( ) => {
259259 ( async ( ) => {
260260 const isAvailable = await mapViewAutoController . isAutoScreenAvailable ( ) ;
261- console . log ( 'isAutoScreenAvailable:' , isAvailable ) ;
262261 setMapViewAutoAvailable ( isAvailable ) ;
263262 } ) ( ) ;
264263 } , [ mapViewAutoController ] ) ;
@@ -312,7 +311,10 @@ const NavigationScreen = () => {
312311 onMapReady,
313312 onMarkerClick : ( marker : Marker ) => {
314313 console . log ( 'onMarkerClick:' , marker ) ;
315- mapViewController ?. removeMarker ( marker . id ) ;
314+ showSnackbar ( 'Removing marker in 5 seconds' ) ;
315+ setTimeout ( ( ) => {
316+ mapViewController ?. removeMarker ( marker . id ) ;
317+ } , 5000 ) ;
316318 } ,
317319 onPolygonClick : ( polygon : Polygon ) => {
318320 console . log ( 'onPolygonClick:' , polygon ) ;
You can’t perform that action at this time.
0 commit comments