Java 类com.facebook.react.devsupport.interfaces.DevOptionHandler 实例源码

项目:react-native-async-storage-dev-menu-item    文件:AsyncStorageDevMenuItemModule.java   
@ReactMethod
public void initialize() {
  ReactApplication application = (ReactApplication)getReactApplicationContext()
    .getCurrentActivity()
    .getApplication();

  DevSupportManager devSupportManager = application
    .getReactNativeHost()
    .getReactInstanceManager()
    .getDevSupportManager();

  devSupportManager.addCustomDevOption("Log AsyncStorage", new DevOptionHandler() {
      @Override
      public void onOptionSelected() {
        getReactApplicationContext()
          .getJSModule(RCTNativeAppEventEmitter.class)
          .emit("LogAsyncStorage", null);
      }
  });
}
项目:react-native-android-activity    文件:MainActivity.java   
/**
 * Demonstrates how to add a custom option to the dev menu.
 * https://stackoverflow.com/a/44882371/3968276
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    MainApplication application = (MainApplication) getApplication();
    ReactNativeHost reactNativeHost = application.getReactNativeHost();
    ReactInstanceManager reactInstanceManager = reactNativeHost.getReactInstanceManager();
    DevSupportManager devSupportManager = reactInstanceManager.getDevSupportManager();
    devSupportManager.addCustomDevOption("Custom dev option", new DevOptionHandler() {
        @Override
        public void onOptionSelected() {
            Toast.makeText(MainActivity.this, "Hello from custom dev option", Toast.LENGTH_SHORT).show();
        }
    });
}
项目:RNLearn_Project1    文件:DevSupportManagerImpl.java   
/**
 * Add option item to dev settings dialog displayed by this manager. In the case user select given
 * option from that dialog, the appropriate handler passed as {@param optionHandler} will be
 * called.
 */
@Override
public void addCustomDevOption(
    String optionName,
    DevOptionHandler optionHandler) {
  mCustomDevOptions.put(optionName, optionHandler);
}
项目:RNLearn_Project1    文件:DevSupportManagerImpl.java   
/**
 * Add option item to dev settings dialog displayed by this manager. In the case user select given
 * option from that dialog, the appropriate handler passed as {@param optionHandler} will be
 * called.
 */
@Override
public void addCustomDevOption(
    String optionName,
    DevOptionHandler optionHandler) {
  mCustomDevOptions.put(optionName, optionHandler);
}
项目:RNLearn_Project1    文件:DisabledDevSupportManager.java   
@Override
public void addCustomDevOption(String optionName, DevOptionHandler optionHandler) {

}
项目:RNLearn_Project1    文件:DisabledDevSupportManager.java   
@Override
public void addCustomDevOption(String optionName, DevOptionHandler optionHandler) {

}