Removed a wrong assert.

Summary:
This fixes [#15801](https://github.com/facebook/react-native/issues/15801)

We ran into a strange crash on iOS (debug only). After removing the clutter I was able to reproduce it in a tiny app. You can check it out [here.](https://github.com/simonracz/textinput_stress)

The UI in JS and native are not always in sync (which is okay). Due to this, a native view might call back into JS, which is no longer present in the shadow view hierarchy there. I think this should be also okay.

TextInput in some cases calls into [setIntrinsicContentView](6d67e2dbbc/React/Modules/RCTUIManager.m (L382)), where it triggers an overly enthusiastic `NSAssert` and crashes the app.

Check out [textinput_stress](https://github.com/simonracz/textinput_stress)
Rotate the simulator a few times to see the crash or the lack of crash.
Closes https://github.com/facebook/react-native/pull/16170

Differential Revision: D5959776

Pulled By: shergin

fbshipit-source-id: f39f5a3f1d86b330ecf7cbccd90871bc01fd69d9
This commit is contained in:
Simon Racz
2017-10-02 17:40:01 -07:00
committed by Facebook Github Bot
parent 915ac20c76
commit be27f44e1b

View File

@@ -376,7 +376,10 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
NSNumber *reactTag = view.reactTag;
dispatch_async(RCTGetUIManagerQueue(), ^{
RCTShadowView *shadowView = self->_shadowViewRegistry[reactTag];
RCTAssert(shadowView != nil, @"Could not locate view with tag #%@", reactTag);
if (shadowView == nil) {
RCTLogWarn(@"Could not locate shadow view with tag #%@, this is probably caused by a temporary inconsistency between native views and shadow views.", reactTag);
return;
}
if (!CGSizeEqualToSize(shadowView.intrinsicContentSize, size)) {
shadowView.intrinsicContentSize = size;