From 816c32861da81b3994b6fb9066c39103ffa8ff19 Mon Sep 17 00:00:00 2001 From: Joonas Kerttula Date: Fri, 21 Nov 2025 13:10:16 +0200 Subject: [PATCH 1/2] chore: fix layout safe-areas for example app --- example/src/App.tsx | 4 +++- example/src/screens/IntegrationTestsScreen.tsx | 4 +++- example/src/screens/MapIdScreen.tsx | 5 +++-- example/src/screens/MultipleMapsScreen.tsx | 8 +++----- example/src/screens/NavigationScreen.tsx | 4 +++- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/example/src/App.tsx b/example/src/App.tsx index 858bc5e..d91c528 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -21,6 +21,7 @@ import { useNavigation as useAppNavigation, type NavigationProp, } from '@react-navigation/native'; +import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { createStackNavigator } from '@react-navigation/stack'; import { View, Button, Text } from 'react-native'; import { CommonStyles } from './styles/components'; @@ -48,6 +49,7 @@ export type StackNavigation = NavigationProp; const HomeScreen = () => { const { navigate } = useAppNavigation(); const isFocused = useIsFocused(); + const insets = useSafeAreaInsets(); const [sdkVersion, setSdkVersion] = useState(''); const { navigationController } = useNavigation(); @@ -67,7 +69,7 @@ const HomeScreen = () => { }, [navigationController]); return ( - + {/* SDK Version Display */} diff --git a/example/src/screens/IntegrationTestsScreen.tsx b/example/src/screens/IntegrationTestsScreen.tsx index 4f9fb79..63ddb58 100644 --- a/example/src/screens/IntegrationTestsScreen.tsx +++ b/example/src/screens/IntegrationTestsScreen.tsx @@ -18,6 +18,7 @@ import React, { useState, useMemo, useCallback } from 'react'; import { Button, Text, View } from 'react-native'; import Snackbar from 'react-native-snackbar'; +import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { type Circle, @@ -80,6 +81,7 @@ const IntegrationTestsScreen = () => { const [failureMessage, setFailuremessage] = useState(''); const [navigationViewController, setNavigationViewController] = useState(null); + const insets = useSafeAreaInsets(); const onMapReady = useCallback(async () => { console.log('Map is ready, initializing navigator...'); @@ -220,7 +222,7 @@ const IntegrationTestsScreen = () => { }, [testStatus, detoxStepNumber]); return ( - + See CONTRIBUTING.md to see how to run integration tests. { @@ -43,7 +44,7 @@ const MapIdScreen = () => { useState(null); const [navigationUiEnabled, setNavigationUIEnabled] = useState(true); const [nightMode, setNightMode] = useState(0); // 0: Auto, 1: Force Day, 2: Force Night - + const insets = useSafeAreaInsets(); const { arePermissionsApproved } = usePermissions(); const { navigationController, addListeners, removeListeners } = useNavigation(); @@ -172,7 +173,7 @@ const MapIdScreen = () => { return ( {confirmedMapId === null ? ( // Configuration screen diff --git a/example/src/screens/MultipleMapsScreen.tsx b/example/src/screens/MultipleMapsScreen.tsx index af2b785..d3ec2f6 100644 --- a/example/src/screens/MultipleMapsScreen.tsx +++ b/example/src/screens/MultipleMapsScreen.tsx @@ -26,6 +26,7 @@ import PagerView, { type PagerViewOnPageSelectedEvent, } from 'react-native-pager-view'; import Snackbar from 'react-native-snackbar'; +import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { NavigationInitErrorCode, @@ -66,6 +67,7 @@ enum OverlayType { } const MultipleMapsScreen = () => { + const insets = useSafeAreaInsets(); const [mapsVisible, setMapsVisible] = useState(true); const { arePermissionsApproved } = usePermissions(); const [overlayType, setOverlayType] = useState(OverlayType.None); @@ -81,10 +83,6 @@ const MultipleMapsScreen = () => { const { navigationController, addListeners, removeListeners } = useNavigation(); - useEffect(() => { - console.log('mapViewController1 changed', mapViewController1); - }, [mapViewController1]); - const onArrival = useCallback( (event: ArrivalEvent) => { if (event.isFinalDestination) { @@ -303,7 +301,7 @@ const MultipleMapsScreen = () => { }, []); return arePermissionsApproved ? ( - +