Skip to content

Commit 3e10e93

Browse files
committed
fix: RNS, React Navigation and SafeAreaContext
1 parent 92dab15 commit 3e10e93

File tree

8 files changed

+47
-39
lines changed

8 files changed

+47
-39
lines changed

bun.lockb

2.01 KB
Binary file not shown.

example/ios/Podfile.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ PODS:
12611261
- React-jsiexecutor
12621262
- React-RCTFBReactNativeSpec
12631263
- ReactCommon/turbomodule/core
1264-
- react-native-safe-area-context (4.14.0):
1264+
- react-native-safe-area-context (5.2.0):
12651265
- DoubleConversion
12661266
- glog
12671267
- hermes-engine
@@ -1274,8 +1274,8 @@ PODS:
12741274
- React-featureflags
12751275
- React-graphics
12761276
- React-ImageManager
1277-
- react-native-safe-area-context/common (= 4.14.0)
1278-
- react-native-safe-area-context/fabric (= 4.14.0)
1277+
- react-native-safe-area-context/common (= 5.2.0)
1278+
- react-native-safe-area-context/fabric (= 5.2.0)
12791279
- React-NativeModulesApple
12801280
- React-RCTFabric
12811281
- React-rendererdebug
@@ -1284,7 +1284,7 @@ PODS:
12841284
- ReactCommon/turbomodule/bridging
12851285
- ReactCommon/turbomodule/core
12861286
- Yoga
1287-
- react-native-safe-area-context/common (4.14.0):
1287+
- react-native-safe-area-context/common (5.2.0):
12881288
- DoubleConversion
12891289
- glog
12901290
- hermes-engine
@@ -1305,7 +1305,7 @@ PODS:
13051305
- ReactCommon/turbomodule/bridging
13061306
- ReactCommon/turbomodule/core
13071307
- Yoga
1308-
- react-native-safe-area-context/fabric (4.14.0):
1308+
- react-native-safe-area-context/fabric (5.2.0):
13091309
- DoubleConversion
13101310
- glog
13111311
- hermes-engine
@@ -1636,7 +1636,7 @@ PODS:
16361636
- ReactCommon/turbomodule/bridging
16371637
- ReactCommon/turbomodule/core
16381638
- Yoga
1639-
- RNScreens (3.35.0):
1639+
- RNScreens (4.9.1):
16401640
- DoubleConversion
16411641
- glog
16421642
- hermes-engine
@@ -1657,9 +1657,9 @@ PODS:
16571657
- ReactCodegen
16581658
- ReactCommon/turbomodule/bridging
16591659
- ReactCommon/turbomodule/core
1660-
- RNScreens/common (= 3.35.0)
1660+
- RNScreens/common (= 4.9.1)
16611661
- Yoga
1662-
- RNScreens/common (3.35.0):
1662+
- RNScreens/common (4.9.1):
16631663
- DoubleConversion
16641664
- glog
16651665
- hermes-engine
@@ -1944,7 +1944,7 @@ SPEC CHECKSUMS:
19441944
React-logger: 795cd5055782db394f187f9db0477d4b25b44291
19451945
React-Mapbuffer: 0502faf46cab8fb89cfc7bf3e6c6109b6ef9b5de
19461946
React-microtasksnativemodule: 663bc64e3a96c5fc91081923ae7481adc1359a78
1947-
react-native-safe-area-context: ef245940fb88805d1f1d762068cde5c56d43ba37
1947+
react-native-safe-area-context: 9c33120e9eac7741a5364cc2d9f74665049b76b3
19481948
React-NativeModulesApple: 16fbd5b040ff6c492dacc361d49e63cba7a6a7a1
19491949
React-perflogger: ab51b7592532a0ea45bf6eed7e6cae14a368b678
19501950
React-performancetimeline: bc2e48198ec814d578ac8401f65d78a574358203
@@ -1974,7 +1974,7 @@ SPEC CHECKSUMS:
19741974
ReactCodegen: 1f6437d1ad7db1aeb47cbc27b7b980a4f7a19b6b
19751975
ReactCommon: 3d39389f8e2a2157d5c999f8fba57bd1c8f226f0
19761976
RNNitroSQLite: d840ee69ea72a9ac3232b124a4fff57055a5e810
1977-
RNScreens: 520a873712f4a9822e18004d6959ed0daba38367
1977+
RNScreens: 991214b4e69016c1ae32830d9cea31c9c9422367
19781978
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
19791979
Yoga: afd04ff05ebe0121a00c468a8a3c8080221cb14c
19801980

example/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
},
1616
"dependencies": {
1717
"@craftzdog/react-native-buffer": "^6.0.5",
18-
"@react-navigation/native": "^6.1.18",
19-
"@react-navigation/native-stack": "^6.11.0",
18+
"@react-navigation/native": "^7.0.14",
19+
"@react-navigation/native-stack": "^7.2.0",
2020
"chai": "^4.3.7",
2121
"chance": "^1.1.9",
2222
"events": "^3.3.0",
@@ -25,8 +25,8 @@
2525
"react-native": "0.78.0",
2626
"react-native-nitro-modules": "0.24.1",
2727
"react-native-nitro-sqlite": "9.1.4",
28-
"react-native-safe-area-context": "^4.14.0",
29-
"react-native-screens": "^3.35.0",
28+
"react-native-safe-area-context": "^5.2.0",
29+
"react-native-screens": "^4.9.1",
3030
"reflect-metadata": "^0.1.13",
3131
"stream-browserify": "^3.0.0",
3232
"typeorm": "^0.3.20",

example/src/App.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
import React from 'react'
22
import 'reflect-metadata'
3-
import { UnitTestScreen } from './screens/UnitTestScreen'
4-
import { BenchmarkScreen } from './screens/BenchmarkScreen'
5-
import { createNativeStackNavigator } from '@react-navigation/native-stack'
63
import { NavigationContainer } from '@react-navigation/native'
74
import { StatusBar } from 'expo-status-bar'
8-
import type { ParamList } from './navigation'
5+
import { RootStack } from './navigation'
96
import { HomeScreen } from './screens/HomeScreen'
10-
11-
const Stack = createNativeStackNavigator<ParamList>()
7+
import { UnitTestScreen } from './screens/UnitTestScreen'
8+
import { BenchmarkScreen } from './screens/BenchmarkScreen'
129

1310
export default function App() {
1411
return (
1512
<NavigationContainer>
16-
<Stack.Navigator initialRouteName="NitroSQLite Example">
17-
<Stack.Screen name="NitroSQLite Example" component={HomeScreen} />
18-
<Stack.Screen name="Unit Tests" component={UnitTestScreen} />
19-
<Stack.Screen name="Benchmarks" component={BenchmarkScreen} />
20-
</Stack.Navigator>
13+
<RootStack.Navigator initialRouteName="NitroSQLite Example">
14+
<RootStack.Screen name="NitroSQLite Example" component={HomeScreen} />
15+
<RootStack.Screen name="Unit Tests" component={UnitTestScreen} />
16+
<RootStack.Screen name="Benchmarks" component={BenchmarkScreen} />
17+
</RootStack.Navigator>
2118

2219
<StatusBar style="auto" />
2320
</NavigationContainer>

example/src/navigation.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1-
export type ParamList = {
2-
'NitroSQLite Example': undefined
3-
'Unit Tests': undefined
4-
'Benchmarks': undefined
1+
import { StaticParamList } from '@react-navigation/native'
2+
import { createNativeStackNavigator } from '@react-navigation/native-stack'
3+
import { HomeScreen } from './screens/HomeScreen'
4+
import { UnitTestScreen } from './screens/UnitTestScreen'
5+
import { BenchmarkScreen } from './screens/BenchmarkScreen'
6+
7+
export const RootStack = createNativeStackNavigator({
8+
screens: {
9+
'NitroSQLite Example': HomeScreen,
10+
'Unit Tests': UnitTestScreen,
11+
'Benchmarks': BenchmarkScreen,
12+
},
13+
})
14+
15+
type RootStackParamList = StaticParamList<typeof RootStack>
16+
17+
declare global {
18+
namespace ReactNavigation {
19+
interface RootParamList extends RootStackParamList {}
20+
}
521
}

example/src/screens/BenchmarkScreen.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import {
99
View,
1010
} from 'react-native'
1111
import { StatusBar } from 'expo-status-bar'
12-
import type { NativeStackScreenProps } from '@react-navigation/native-stack'
13-
import type { ParamList } from '../navigation'
1412
import { ScreenStyles } from '../styles'
1513
import { resetLargeDb, largeDb, testDb, resetTestDb } from '../tests/db'
1614

@@ -96,9 +94,7 @@ function runBenchmark(benchmark: Benchmark) {
9694
})
9795
}
9896

99-
type Props = NativeStackScreenProps<ParamList, 'Benchmarks'>
100-
101-
export const BenchmarkScreen: React.FC<Props> = () => {
97+
export function BenchmarkScreen() {
10298
const [results, setResults] = useState<Record<string, string | null>>({})
10399
const [isLoading, setIsLoading] = useState(false)
104100

example/src/screens/HomeScreen.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React from 'react'
22
import { ScrollView, Text, TouchableOpacity } from 'react-native'
3-
import type { NativeStackScreenProps } from '@react-navigation/native-stack'
4-
import type { ParamList } from '../navigation'
53
import { StatusBar } from 'expo-status-bar'
64
import { ScreenStyles } from '../styles'
5+
import { useNavigation } from '@react-navigation/native'
76

8-
type Props = NativeStackScreenProps<ParamList, 'NitroSQLite Example'>
7+
export function HomeScreen() {
8+
const navigation = useNavigation()
99

10-
export const HomeScreen: React.FC<Props> = ({ navigation }) => {
1110
return (
1211
<ScrollView contentContainerStyle={ScreenStyles.container}>
1312
<TouchableOpacity onPress={() => navigation.navigate('Unit Tests')}>

example/src/screens/UnitTestScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { runTests } from '../tests/MochaSetup'
55
import { registerUnitTests } from '../tests/unitTests.spec'
66
import { ScreenStyles } from '../styles'
77

8-
export const UnitTestScreen: React.FC = () => {
8+
export function UnitTestScreen() {
99
const [results, setResults] = useState<MochaTestResult[]>([])
1010

1111
useEffect(() => {

0 commit comments

Comments
 (0)