Created
November 5, 2018 16:21
-
-
Save Kudo/53e1d276a91987eee7d61713bc897775 to your computer and use it in GitHub Desktop.
CxxModule exports method bar() that will send JS event to simulate AppState changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto HelloCxxModule::getMethods() -> std::vector<Method> { | |
return { | |
Method("bar", | |
[this]() { | |
if (auto reactInstance = getInstance().lock()) { | |
reactInstance->callJSFunction( | |
"RCTDeviceEventEmitter", "emit", | |
folly::dynamic::array( | |
"appStateDidChange", | |
folly::dynamic::object("app_state", "active"))); | |
} | |
}), | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment