GithubHelp home page GithubHelp logo

Comments (10)

zoontek avatar zoontek commented on August 17, 2024 1

@Protino This is available in the next RC: #563

from react-native-bootsplash.

Protino avatar Protino commented on August 17, 2024

I can see that there are a few static variables in RNBootSplashModuleImpl these remain as is upon activity re-creation and re-initialization is not done because of the check on if (mThemeResId != -1) {

from react-native-bootsplash.

zoontek avatar zoontek commented on August 17, 2024

Legitimate question, but: what does it solves in real life? Excepted if you enable Don't keep activities, which is in a hidden menu of your phone, you will probably never met this kind of behaviour.

PS: The fix should implement onHostDestroy instead.

from react-native-bootsplash.

Protino avatar Protino commented on August 17, 2024

No no, that option is just for debugging scenarios where activity process is killed. For ex: app is in background, system kills it to recoup resources and when user re-opens the app this behaviour will occur. Other scenarios include - orientation change, device locale changes like font size etc.
https://developer.android.com/guide/components/activities/activity-lifecycle#asem

Will update the PR to use onHostDestroy instead. Thanks.

from react-native-bootsplash.

zoontek avatar zoontek commented on August 17, 2024

@Protino When this occur, the app will "start" again. Meaning that the Activity will be recreating, react native modules instances recreated, etc.

I would love to perform a real life reproduction (ex: it should occur when rotating the device, or entering multi window mode - it appears not) to be sure that it's indeed fixing something and not creating an issue instead. Nothing would be worst than recreating the splash screen (as you "reinit" the variables, it will show the Dialog again, and if the react app doesn't restart, the user will be stuck on it, as hide() will not be called)

from react-native-bootsplash.

Protino avatar Protino commented on August 17, 2024

When app restarts, the activity is recreated but other instances are not and in this case it is the RNBootSplashModuleImpl instance which holds data in static variables and these hold old values. So when init is called it is returned without initializing.

We've this occurring on one of our production app. You can reproduce this by cloning the repro i mentioned. Run it, press home button, go to settings and change font size and reopen the app from background. (Another real life scenario would be keep the app in background state and open other resource heavy apps like games etc.. and re-open the app, this would be tedious to repro).

Yes i agree that re-initializing would be terrible if dialog is already shown, but as far as i have gone through the source code this won't occur, init is only called on Activity creation as recommended and we de-initialize only on activity destroy.

from react-native-bootsplash.

zoontek avatar zoontek commented on August 17, 2024

@Protino Did you tried with onHostDestroy?

from react-native-bootsplash.

Protino avatar Protino commented on August 17, 2024

Yes, PR updated long back - #553

from react-native-bootsplash.

zoontek avatar zoontek commented on August 17, 2024

Thanks @Protino, it will be in the next release.

from react-native-bootsplash.

zoontek avatar zoontek commented on August 17, 2024

Available in 5.5.0

from react-native-bootsplash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.