Slide 12
Slide 12 text
• @ReactMethod Exports the Method to RN
!12
// android/src/main/java/com/reactlibrary/RNMyLibraryModule.java
package com.reactlibrary;
import …;
public class RNMyLibraryModule extends ReactContextBaseJavaModule {
private final ReactApplicationContext reactContext;
public RNMyLibraryModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
}
@Override
public String getName() {
return "RNMyLibrary";
}
@ReactMethod
public void hello(String name) {
Log.d("RNMyLibrary", String.format("Hello, %s", name));
}
}
Add `hello` method