[iOS] Remove dropped native handlers #3819
Merged
+17
−5
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.
What is happening
While working on #3800 I've noticed frequent crashes on
iOS. I'll explain this using the demo from the test code, basically two screens, second screen has aRectButton.Sometime it crashes immediately on startup.
Why is it happening?
Nativehandlers are handled differently compared to others. The main problem was that we tried to attach handler that was previously dropped, butNativeDetectorhas no information that this happened. The flow here looks as follows:addSubviewis called - at this point it won't attach anything as_nativeHandlersis emptyupdatePropsis called - handlers are attachedaddSubviewis called - it tries to attach handler that was dropped, therefore app crashesSolution
To fix this issue, we clear
_nativeHandlersinprepareForRecyclemethod.Test plan
I've tested it on my branch with components re-written to new API, using the following code in EmptyExample: