Skip to content

[0.76]How to dynamically load JsBundle from local storage on New Architecture 0.76? #242

Answered by cortinico
baka3k asked this question in Q&A
Discussion options

You must be logged in to vote

I want to change JsBundle in my application, I have 2 bundle file :

Ok so that's a different kind of problem as you'll have to effectively reload the app.
You'll have to use the reload() method from ReactHost:

https://github.com/facebook/react-native/blob/7211119d2325a67067f9dd7296cdcb9f91624c7f/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt#L108

The ReactHost is specified in the property you have in the MainApplication:

  override val reactHost: ReactHost
    get() = getDefaultReactHost(applicationContext, reactNativeHost)

I'm also unsure if the bundle is cached so I'm unsure if this effectively works, we'll have to try. Do you have a sample project I…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@cortinico
Comment options

Answer selected by baka3k
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants