tinycreative / react-native-intercom

React Native wrapper for Intercom.io
MIT License
406 stars 280 forks source link

Crash on open from alert #368

Closed renanpupin closed 4 years ago

renanpupin commented 4 years ago

The following code causes app crash when is opened twice.

Steps to reproduce:

Alert.alert( 'Open intercom', 'Do you want to open it?', [ { text: 'YES', onPress: () => { Intercom.displayMessageComposer(); } } ], );

renanpupin commented 4 years ago

I can confirm that it is happening triggering an alert after open messenger.

cbrevik commented 4 years ago

I've also encountered this error. Showing an alert at a later point (after the messenger has been opened) will crash the app with the following message:

Tried to display alert view but there is no application window. args: {
    <snip>
}

-[RCTAlertManager alertWithArgs:callback:]
    RCTAlertManager.mm:108
__invoking___
-[NSInvocation invoke]
-[NSInvocation invokeWithTarget:]
-[RCTModuleMethod invokeWithBridge:module:arguments:]
facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&)
facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_0::operator()() const
invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
UIApplicationMain
main
start
0x0
renanpupin commented 4 years ago

Solved in https://github.com/tinycreative/react-native-intercom/pull/370