fix: preserve Android images with bounded lifecycle - #91
Open
huhuanming wants to merge 6 commits into
Open
Conversation
originalix
reviewed
Sep 5, 2026
| private val requestManager by lazy(LazyThreadSafetyMode.NONE) { | ||
| val activity = context.findFragmentActivity() | ||
| ?: (context.currentActivity as? FragmentActivity) | ||
| Glide.with(requireNotNull(activity) { "A FragmentActivity is required to load images" }) |
Contributor
There was a problem hiding this comment.
P1: [Default ReactActivity hosts cannot initialize the image request manager]
When this package runs in a standard React Native host such as the repository example's MainActivity : ReactActivity(), that Activity is not a FragmentActivity. Both lookups therefore return null, and requireNotNull throws when the first image request accesses requestManager, so the component crashes instead of loading the image.
Please unwrap or read the host as android.app.Activity and pass that Activity to Glide's Activity overload. This preserves Activity-scoped cleanup without excluding standard React Native hosts.
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
Root causes
Verification
Release note
3.0.104 supersedes the application-scoped Android image workaround from 3.0.102 and includes the background-thread DevSession file loading fix first released in 3.0.103.
Platform scope