mfikes/ambly

App init fails due to React Native v0.10.0 not handling events without names well

tblomseth opened this issue · 1 comments

After having upgraded to React Native v.0.10.0 app init fails with the following exception:

* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSCFConstantString substringToIndex:]: Index 1 out of bounds; string length 0'

The offending code is line 233 in the AppDelegate.m from https://github.com/omcljs/ambly/wiki/ClojureScript-React-Native-Quick-Start;

[rootView.bridge.modules[@"RCTEventDispatcher"] sendInputEventWithName:@"" body:@{@"target": @1}];

Commit facebook/react-native@48af214 to RN introduced a normalization of event names that doesn't handle empty strings well.

Using some event name instead of an empty string alleviates the issue:

  [rootView.bridge.modules[@"RCTEventDispatcher"] sendInputEventWithName:@"dummy" body:@{@"target": @1}];

Thanks! Updated the instructions.