mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-12 21:33:20 +08:00
Don't assume JS integers are dynamic Ints
Reviewed By: kathryngray Differential Revision: D5643016 fbshipit-source-id: 2e4e1bce013e16c286745dc2a9aa5ff251f7afdd
This commit is contained in:
committed by
Facebook Github Bot
parent
2292023a1b
commit
f6de2e4a9b
@@ -18,11 +18,11 @@ namespace react {
|
||||
|
||||
std::function<void(folly::dynamic)> makeCallback(
|
||||
std::weak_ptr<Instance> instance, const folly::dynamic& callbackId) {
|
||||
if (!callbackId.isInt()) {
|
||||
if (!callbackId.isNumber()) {
|
||||
throw std::invalid_argument("Expected callback(s) as final argument");
|
||||
}
|
||||
|
||||
auto id = callbackId.getInt();
|
||||
auto id = callbackId.asInt();
|
||||
return [winstance = std::move(instance), id](folly::dynamic args) {
|
||||
if (auto instance = winstance.lock()) {
|
||||
instance->callJSCallback(id, std::move(args));
|
||||
|
||||
Reference in New Issue
Block a user