Fixed crash if event doesn't have body parameter (#23711)
Summary: We need to check `body[@"target"]` wether equal to `nil`, if it is, return to prevent crash. [iOS] [Fixed] - Fixed crash if event doesn't have body parameter Pull Request resolved: https://github.com/facebook/react-native/pull/23711 Differential Revision: D14298543 Pulled By: cpojer fbshipit-source-id: d5e8cd69438f323ae102e61618c0371a01bee347
This commit is contained in:
Родитель
ced155327e
Коммит
7025cce3f4
|
@ -86,10 +86,14 @@ RCT_EXPORT_MODULE()
|
|||
@"Event body dictionary must include a 'target' property containing a React tag");
|
||||
}
|
||||
|
||||
if (!body[@"target"]) {
|
||||
return;
|
||||
}
|
||||
|
||||
name = RCTNormalizeInputEventName(name);
|
||||
[_bridge enqueueJSCall:@"RCTEventEmitter"
|
||||
method:@"receiveEvent"
|
||||
args:body ? @[body[@"target"], name, body] : @[body[@"target"], name]
|
||||
args:@[body[@"target"], name, body]
|
||||
completion:NULL];
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче