refactor: do not rely on deep imports#1000
Merged
kirillzyusko merged 4 commits intomainfrom Jul 1, 2025
Merged
Conversation
Contributor
📊 Package size report
|
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.
📜 Description
Don't rely on deep imports and provide a warning free compatibility with RN 0.80+ (by utilizing a more official and reliable way to substitute native module implementation).
💡 Motivation and Context
Originally implementation substitution was implemented in #30
Starting from
react-native@0.80deep imports were deprecated and now if you try to use them you get a warning:In version
0.82the ability to use deep imports will be completely removed. In preparation of that RN team opened a discussion on GitHub about those upcoming changes.This library uses deep imports to substitute
StatusBarimplementation. I opened a thread to discuss how we can overcome it. While waiting for a proposed solution I discovered, that we can override native modules with own implementation - this is the case that I want to use. I want to substitute the implementation ofStatusBarand fallback to default implementation ifEdgeToEdgeview is disabled.📢 Changelog
JS
monkey-patchcode;Android
StatusBarManagerCompattoStatusBarManagerto match name of original module;getConstantsmethod;StatusBarManagerCompatnow can override existing modules;activeprop public;setActivesetter field-setter to avoid compilation conflicts;StatusBarManagerCompatnow respectsactiveprops and fallbacks toStatusBarManagerimplementation ifedge-to-edgeview is disabled;isEnabled/viewtoStatusBarManagerCompatto reduce code duplication.🤔 How Has This Been Tested?
Tested manually on:
📸 Screenshots (if appropriate):
Screen.Recording.2025-07-01.at.19.51.45.mov
📝 Checklist