Last active
January 1, 2019 21:51
-
-
Save ryardley/3dac2e43f4b9df9548e872c7b8e82d27 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// android/app/src/main/java/com/cppreactnative/helloworld/HelloWorldModule.java | |
package com.cppreactnative.helloworld; | |
import com.facebook.react.bridge.Promise; | |
import com.facebook.react.bridge.ReactApplicationContext; | |
import com.facebook.react.bridge.ReactContextBaseJavaModule; | |
import com.facebook.react.bridge.ReactMethod; | |
public class HelloWorldModule extends ReactContextBaseJavaModule { | |
public HelloWorldModule(ReactApplicationContext reactContext) { | |
super(reactContext); //required by React Native | |
} | |
@Override | |
public String getName() { | |
return "HelloWorld"; //HelloWorld is how this module will be referred to from React Native | |
} | |
@ReactMethod | |
public void sayHello(Promise promise) { //this method will be called from JS by React Native | |
promise.resolve("Hello from Android"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment