Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation.events().registerAppLaunchedListener events not called and App stuck in splash screen Android #7914

Open
1 task done
AlpeshItIdol opened this issue Sep 19, 2024 · 0 comments

Comments

@AlpeshItIdol
Copy link

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?

  • 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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant