Closed grahammendick closed 3 weeks ago
Correction - the reason it didn't happen on the old architecture was because set reactSubview to nil so it didn't do anything in dealloc. Forgot to do that on Fabric in unmount. The if check added for safety on old architecture wasn't necessary because if it's nil then iOS won't remove - but harmless to leave it in there
Fixes #797
When the
SearchBar
is unmounted on Fabric the Navigation router throws an error because it tries to remove the keyPath observer twice. (This only happens on Fabric because React Native unmounts the child and then iOS calls dealloc - on the old arch React Native doesn't callremoveReactSubview
).Retested the original scenario for why the keyPath observer was introduced and the problem doesn't happen on Fabric. The search results aren't shown when first tapping the search bar. So removed the keyPath observer logic on Fabric.
(Even though the double remove didn't happen on the old architecture, added a defensive check in dealloc to make sure the observer is only removed if it's still added.)