Skip to content

Instantly share code, notes, and snippets.

@ShaileshPrajapati-BTC
Last active April 7, 2018 07:36
Show Gist options
  • Save ShaileshPrajapati-BTC/19b1a8def87781e078348f35161123ba to your computer and use it in GitHub Desktop.
Save ShaileshPrajapati-BTC/19b1a8def87781e078348f35161123ba to your computer and use it in GitHub Desktop.
package com.toast;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import android.widget.Toast;
public class ToastModule extends ReactContextBaseJavaModule {
public ToastModule(ReactApplicationContext reactContext) {
super(reactContext);
}
@Override
public String getName() {
return "ToastModule";
}
@ReactMethod
public void show(string message) {
Toast.makeText(getReactApplicationContext(), message, Toast.LENGTH_LONG).show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment