From 3a3d884df253dbc1c02ffef33e99c4a91ea8751b Mon Sep 17 00:00:00 2001 From: Douglas Date: Fri, 16 Feb 2018 14:28:16 -0800 Subject: [PATCH] tvOS: TV nav event emitter should check for bridge Summary: When running with the packager in the tvOS simulator, reloading from the packager hits an assert in `RCTEventEmitter`, causing a crash. The solution is for `RCTTVNavigationEventEmitter` to check for the existence of the bridge before attempting to send an event. Manual testing. [IOS] [BUGFIX] [RCTTVNavigationEventEmitter.m] - Fix crash when reloading in tvOS Closes https://github.com/facebook/react-native/pull/17797 Differential Revision: D7014975 Pulled By: hramos fbshipit-source-id: 0bf766e87267ca8592ff0cc0b3cb4621a8e8f9b5 --- React/Modules/RCTTVNavigationEventEmitter.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/React/Modules/RCTTVNavigationEventEmitter.m b/React/Modules/RCTTVNavigationEventEmitter.m index 12d177584..bbc42e14f 100644 --- a/React/Modules/RCTTVNavigationEventEmitter.m +++ b/React/Modules/RCTTVNavigationEventEmitter.m @@ -46,7 +46,9 @@ RCT_EXPORT_MODULE() - (void)handleTVNavigationEventNotification:(NSNotification *)notif { - [self sendEventWithName:TVNavigationEventName body:notif.object]; + if (self.bridge) { + [self sendEventWithName:TVNavigationEventName body:notif.object]; + } } @end