Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tomekzaw
marked this pull request as ready for review
October 31, 2026 08:23
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Abbondanzo
requested changes
Nov 3, 2026
| // FrescoModule initializes Fresco on the native modules thread while the JS bundle loads, so | ||
| // the first Image can be created before that finishes. Getting the module waits for it. | ||
| // Fresco.hasBeenInitialized() doesn't help here: it turns true when initialization starts. | ||
| context.reactApplicationContext.getNativeModule(FrescoModule::class.java) |
Contributor
There was a problem hiding this comment.
Fresco initialization can be pretty costly, and the createViewInstance method is called on the main thread. Since the builder isn't called until the image mounts and has dimensions, could we instead make the constructor argument a Provider<T> for a drawee controller builder?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
In bridgeless mode, eager modules are created on the native modules thread while the JS bundle loads (
ReactHostImpl).FrescoModuleis one of them, and it initializes Fresco. If the first render preallocates anImagebefore that has finished,ReactImageManager.createViewInstancecallsFresco.newDraweeControllerBuilder()too early and the app crashes on startup:When
FrescoModulehasn't finished initializing Fresco,createViewInstancenow gets the module first.TurboModuleManagerthen either waits for the other thread to finish creating it or creates it on the spot. This usesFrescoModule.hasBeenInitialized()rather thanFresco.hasBeenInitialized(), because Fresco sets its flag when initialization starts, not when it ends. Once Fresco is initialized, the only extra work is reading that flag.Changelog:
[ANDROID] [FIXED] - Fix a startup crash when an
Imageis created before Fresco finishes initializingTest Plan:
Release RNTester (
./gradlew :packages:rn-tester:android:app:assembleRelease -PreactNativeArchitectures=arm64-v8a), cold-started from the launcher repeatedly on a Galaxy A16 (Android 16). A run counts as a crash when the log has the stack trace above.mainAfter the change, the Image examples load their network images as before.
🤖 Generated with Claude Code