Java Code Examples for com.facebook.react.bridge.WritableNativeMap.putBoolean()

The following are Jave code examples for showing how to use putBoolean() of the com.facebook.react.bridge.WritableNativeMap class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: RNLearn_Project1   File: Arguments.java   Source Code and License Vote up 6 votes
private static void addEntry(WritableNativeMap nativeMap, String key, Object value) {
  value = makeNativeObject(value);
  if (value == null) {
    nativeMap.putNull(key);
  } else if (value instanceof Boolean) {
    nativeMap.putBoolean(key, (Boolean) value);
  } else if (value instanceof Integer) {
    nativeMap.putInt(key, (Integer) value);
  } else if (value instanceof Number) {
    nativeMap.putDouble(key, ((Number) value).doubleValue());
  } else if (value instanceof String) {
    nativeMap.putString(key, (String) value);
  } else if (value instanceof WritableNativeArray) {
    nativeMap.putArray(key, (WritableNativeArray) value);
  } else if (value instanceof WritableNativeMap) {
    nativeMap.putMap(key, (WritableNativeMap) value);
  } else {
    throw new IllegalArgumentException("Could not convert " + value.getClass());
  }
}
 
Example 2
Project: RNLearn_Project1   File: Arguments.java   Source Code and License Vote up 6 votes
private static void addEntry(WritableNativeMap nativeMap, String key, Object value) {
  value = makeNativeObject(value);
  if (value == null) {
    nativeMap.putNull(key);
  } else if (value instanceof Boolean) {
    nativeMap.putBoolean(key, (Boolean) value);
  } else if (value instanceof Integer) {
    nativeMap.putInt(key, (Integer) value);
  } else if (value instanceof Number) {
    nativeMap.putDouble(key, ((Number) value).doubleValue());
  } else if (value instanceof String) {
    nativeMap.putString(key, (String) value);
  } else if (value instanceof WritableNativeArray) {
    nativeMap.putArray(key, (WritableNativeArray) value);
  } else if (value instanceof WritableNativeMap) {
    nativeMap.putMap(key, (WritableNativeMap) value);
  } else {
    throw new IllegalArgumentException("Could not convert " + value.getClass());
  }
}
 
Example 3
Project: RNLearn_Project1   File: CatalystNativeJavaToJSArgumentsTestCase.java   Source Code and License Vote up 5 votes
public void testMapWithBasicTypes() {
  WritableNativeMap map = new WritableNativeMap();
  map.putString("stringKey", "stringValue");
  map.putDouble("doubleKey", 3.14);
  map.putBoolean("booleanKey", true);
  map.putNull("nullKey");

  mInstance.getJSModule(TestJavaToJSArgumentsModule.class).receiveMapWithBasicTypes(map);
  waitForBridgeAndUIIdle();
  mAssertModule.verifyAssertsAndReset();
}
 
Example 4
Project: RNLearn_Project1   File: CatalystNativeJavaToJSArgumentsTestCase.java   Source Code and License Vote up 5 votes
public void testMapWithBasicTypes() {
  WritableNativeMap map = new WritableNativeMap();
  map.putString("stringKey", "stringValue");
  map.putDouble("doubleKey", 3.14);
  map.putBoolean("booleanKey", true);
  map.putNull("nullKey");

  mInstance.getJSModule(TestJavaToJSArgumentsModule.class).receiveMapWithBasicTypes(map);
  waitForBridgeAndUIIdle();
  mAssertModule.verifyAssertsAndReset();
}