Fix launch crash on iOS 26: update netinfo and add error handling

Crash log showed RCTFatal from an unhandled promise rejection during
startup. The NetInfo listener fires immediately and processOfflineQueue
had no .catch() — fatal in production RN.

Also updated @react-native-community/netinfo from 11.x to 12.x because
11.x uses subscriberCellularProvider (deprecated iOS 12, likely removed
in iOS 26).
This commit is contained in:
Adam Moussa 2026-05-19 19:54:13 -04:00
parent 042339948c
commit a9b720ee08
3 changed files with 15 additions and 13 deletions

View file

@ -10,7 +10,7 @@
"dependencies": {
"@proposal-system/api-contracts": "file:../shared/api-contracts",
"@react-native-async-storage/async-storage": "^2.1.0",
"@react-native-community/netinfo": "^11.4.0",
"@react-native-community/netinfo": "^12.0.1",
"@react-navigation/bottom-tabs": "^7.2.0",
"@react-navigation/native": "^7.0.0",
"@react-navigation/native-stack": "^7.2.0",
@ -1707,9 +1707,9 @@
}
},
"node_modules/@react-native-community/netinfo": {
"version": "11.5.2",
"resolved": "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-11.5.2.tgz",
"integrity": "sha512-/g0m65BtX9HU+bPiCH2517bOHpEIUsGrWFXDzi1a5nNKn5KujQgm04WhL7/OSXWKHyrT8VVtUoJA0XKRxueBpQ==",
"version": "12.0.1",
"resolved": "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-12.0.1.tgz",
"integrity": "sha512-P/3caXIvfYSJG8AWJVefukg+ZGRPs+M4Lp3pNJtgcTYoJxCjWrKQGNnCkj/Cz//zWa/avGed0i/wzm0T8vV2IQ==",
"license": "MIT",
"peerDependencies": {
"react": "*",

View file

@ -11,7 +11,7 @@
"dependencies": {
"@proposal-system/api-contracts": "file:../shared/api-contracts",
"@react-native-async-storage/async-storage": "^2.1.0",
"@react-native-community/netinfo": "^11.4.0",
"@react-native-community/netinfo": "^12.0.1",
"@react-navigation/bottom-tabs": "^7.2.0",
"@react-navigation/native": "^7.0.0",
"@react-navigation/native-stack": "^7.2.0",

View file

@ -41,14 +41,16 @@ function AuthBootstrap({ children }: { children: React.ReactNode }) {
if (state.isConnected) {
processOfflineQueue((data) =>
proposalsApi.create(data as CreateProposalRequest),
).then((count) => {
if (count > 0) {
Alert.alert(
'Synced',
`${count} offline proposal${count > 1 ? 's' : ''} submitted.`,
);
}
});
)
.then((count) => {
if (count > 0) {
Alert.alert(
'Synced',
`${count} offline proposal${count > 1 ? 's' : ''} submitted.`,
);
}
})
.catch(() => {});
}
});
return unsubscribe;