mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Bring missing changes to 0.58-stable branch
This reverts commit b864e7e63e.
This commit is contained in:
@@ -114,6 +114,25 @@ auto SampleCxxModule::getMethods() -> std::vector<Method> {
|
||||
sample_->hello();
|
||||
return nullptr;
|
||||
}, SyncTag),
|
||||
Method("addIfPositiveAsPromise", [](dynamic args, Callback cb, Callback cbError) {
|
||||
auto a = jsArgAsDouble(args, 0);
|
||||
auto b = jsArgAsDouble(args, 1);
|
||||
if (a < 0 || b < 0) {
|
||||
cbError({"Negative number!"});
|
||||
} else {
|
||||
cb({a + b});
|
||||
}
|
||||
}),
|
||||
Method("addIfPositiveAsAsync", [](dynamic args, Callback cb, Callback cbError) {
|
||||
auto a = jsArgAsDouble(args, 0);
|
||||
auto b = jsArgAsDouble(args, 1);
|
||||
if (a < 0 || b < 0) {
|
||||
cbError({"Negative number!"});
|
||||
} else {
|
||||
cb({a + b});
|
||||
}
|
||||
}, AsyncTag),
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user