fix: update workaround preventing React Native from hiding frozen screens to work with RN 0.78 #2778
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
React Native sets
display: 'none'
for frozen screens - this behavior can become an issue, if you for example press back button twice very fast on iOS - frozen screen might still be invisible. The problem and its workaround suggested by @grahammendick can be seen in issue #1207. The workaround was introduced in PR #1208.Recently, React Native 0.78 has changed the way of diffing props and the workaround stopped working. The details and a new workaround has been suggested by @grahammendick once again in issue #2753 and PR grahammendick/navigation#860.
This PR introduces the suggested workaround.
A big thank you to @grahammendick for figuring it out and suggesting the solution once again, appreciate it!
Furthermore, the new workaround fixes a bug with back button on the screen stack header on iOS. The bug was probably introduced with the update to 0.78. The back button would disappear and then reappear after a short delay with generic "Back" label instead of the screen name.
before_2778.mp4
after_2778.mp4
Fixes #2753.
Changes
display: false
todisplay: null
,ViewConfig
interface to allownull
value.Tests
Run
TestFreeze
example, clickGo to Details
twice and then click the back button in the header. The button behaves as expected, which was not the case before - the button would disappear and then reappear with a generic "Back" title.Checklist