Navigation.events().registerAppLaunchedListener events not called and App stuck in splash screen Android
What happened?
I have update Android version 33 to 34 and the update react-native version 0.64.4 to 0.70.2 and My react-native-navigation library version 6.6.2 to 7.35.2 After that app get stuck on splash screen Also Need to confirm that after Updating the react-native-navigation version need to link project with the command npx rnn-link or follow Manual Installation steps?
(Write your steps here:)
Open the app on Android App is stuck on Splash Screen You have to close and reopen the app to enter and switch from Splash Screen to Home Screen
What was the expected behaviour?
Open the app -> Splash Screen -> Home Screen
Was it tested on latest react-native-navigation?
- [X] I have tested this issue on the latest react-native-navigation release and it still reproduces.
Help us reproduce this issue!
Navigation.events().registerAppLaunchedListener(async () => { console.log('App Launched');
Navigation.setDefaultOptions({ statusBar: { style: isAndroid ? 'light' : 'dark', }, layout: { orientation: ['portrait'], topMargin: 0, }, animations: isAndroid ? transitionOptions : undefined, });
try { const [isLoggedInResult, lastInitialLocationResult] = await asyncStorage.multiGet([ 'isLoggedIn', 'lastInitialLocation', ]);
// Parse results
const isLoggedIn = JSON.parse(isLoggedInResult[1]) || false;
const lastInitialLocation: Location = JSON.parse(lastInitialLocationResult[1]) || {};
console.log('isLoggedIn:', isLoggedIn);
console.log('lastInitialLocation:', lastInitialLocation);
const languages = getLocales().map((locale) => locale.languageTag);
console.log('languages:', languages);
const firstLanguage = languages[0].toLowerCase();
const locales = moment.locales();
let language = locales.find((lang) => lang === firstLanguage);
if (!language) {
const region = locales.find((lang) => lang === firstLanguage.split('-')[1].toLowerCase());
language = region ? region.toLowerCase() : i18n.getUsedLanguage().split('-')[0];
}
moment.updateLocale(language, {
longDateFormat: {
LT: uses24HourClock()
? i18n.t('time.twentyFourHourFormat')
: i18n.t('time.twelveHourFormat'),
} as any,
meridiem: (hour) => (hour < 12 ? i18n.t('time.meridiemAM') : i18n.t('time.meridiemPM')),
});
moment.locale(language);
const startScreen = isLoggedIn ? screenIds.MAIN : screenIds.LOGIN;
startAppWithScreen(startScreen, { lastInitialLocation });
} catch (error) { console.error('Error retrieving AsyncStorage data:', error); } });
In what environment did this happen?
React Native Navigation version: 7.35.2 React Native version: 0.70.2 Has Fabric (React Native's new rendering system) enabled: (yes/no) Node version: v18.19.0 Device model: Android version: