fix(android): exclude ad views from instance state saving - #874
Merged
mikehardy merged 1 commit intoAug 17, 2026
Merged
Conversation
Mediation adapters such as Facebook Audience Network persist view state under small view ids that collide with React Native view tags, crashing when react-native-screens restores fragment state.
mikehardy
approved these changes
Aug 17, 2026
mikehardy
left a comment
Collaborator
There was a problem hiding this comment.
nice - thanks for this fix @philipheinser - it looks spot on
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #874 +/- ##
==========================================
- Coverage 43.72% 39.35% -4.37%
==========================================
Files 30 36 +6
Lines 549 671 +122
Branches 151 169 +18
==========================================
+ Hits 240 264 +24
- Misses 309 407 +98 🚀 New features to boost your workflow:
|
Collaborator
|
ios failure is an unrelated e2e flake, I'll shore that up in an e2e pass shortly. this is good to go |
Collaborator
|
🎉 This PR is included in version 16.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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
Banner and native ad views can crash on Android when a fragment (for example
react-native-screens) restores view hierarchy state.Mediation adapters such as Facebook Audience Network persist view state under small view ids. Those ids collide with React Native view tags, which produces:
This disables instance-state save/restore on the ad view wrappers so parent fragments no longer restore adapter-owned state.
Related issues
None.
Release Summary
fix(android): exclude ad views from instance state saving to prevent mediation adapter crashes
Checklist
and followed the process outlined there for submitting PRs.
AndroidiOSe2etests added or updated in__tests__e2e__jesttests added or updated in__tests__Test Plan
Reproduced by navigating away from a screen that shows a GAM banner or native ad mediated by Facebook Audience Network, then returning so
react-native-screensrestores the fragment view state. Without this change the activity crashes; withsetSaveFromParentEnabled(false)/isSaveFromParentEnabled = falsethe restore succeeds.🔥