當前位置: 首頁>>代碼示例>>Java>>正文


Java WritableNativeMap.putString方法代碼示例

本文整理匯總了Java中com.facebook.react.bridge.WritableNativeMap.putString方法的典型用法代碼示例。如果您正苦於以下問題:Java WritableNativeMap.putString方法的具體用法?Java WritableNativeMap.putString怎麽用?Java WritableNativeMap.putString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.facebook.react.bridge.WritableNativeMap的用法示例。


在下文中一共展示了WritableNativeMap.putString方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testStringWithMultibyteUTF8Characters

import com.facebook.react.bridge.WritableNativeMap; //導入方法依賴的package包/類
public void testStringWithMultibyteUTF8Characters() {
  TestJavaToJSArgumentsModule jsModule = mInstance.getJSModule(TestJavaToJSArgumentsModule.class);

  WritableNativeMap map = new WritableNativeMap();
  map.putString("two-bytes", "\u00A2");
  map.putString("three-bytes", "\u20AC");
  map.putString("four-bytes", "\uD83D\uDE1C");
  map.putString(
      "mixed",
      "\u017C\u00F3\u0142\u0107 g\u0119\u015Bl\u0105 \u6211 \uD83D\uDE0E ja\u017A\u0107");

  jsModule.receiveMapWithMultibyteUTF8CharacterString(map);
  waitForBridgeAndUIIdle();
  mAssertModule.verifyAssertsAndReset();

  WritableArray array = new WritableNativeArray();
  array.pushString("\u00A2");
  array.pushString("\u20AC");
  array.pushString("\uD83D\uDE1C");
  array.pushString(
      "\u017C\u00F3\u0142\u0107 g\u0119\u015Bl\u0105 \u6211 \uD83D\uDE0E ja\u017A\u0107");

  jsModule.receiveArrayWithMultibyteUTF8CharacterString(array);
  waitForBridgeAndUIIdle();
  mAssertModule.verifyAssertsAndReset();
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:27,代碼來源:CatalystNativeJavaToJSArgumentsTestCase.java

示例2: addEntry

import com.facebook.react.bridge.WritableNativeMap; //導入方法依賴的package包/類
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());
  }
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:21,代碼來源:Arguments.java

示例3: testMapWithNullStringValue

import com.facebook.react.bridge.WritableNativeMap; //導入方法依賴的package包/類
public void testMapWithNullStringValue() {
  WritableNativeMap map = new WritableNativeMap();
  map.putString("string", null);
  map.putArray("array", null);
  map.putMap("map", null);

  WritableNativeArray array = new WritableNativeArray();
  array.pushString(null);
  array.pushArray(null);
  array.pushMap(null);

  mInstance.getJSModule(TestJavaToJSArgumentsModule.class)
      .receiveMapAndArrayWithNullValues(map, array);
  waitForBridgeAndUIIdle();
  mAssertModule.verifyAssertsAndReset();
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:17,代碼來源:CatalystNativeJavaToJSArgumentsTestCase.java

示例4: convert

import com.facebook.react.bridge.WritableNativeMap; //導入方法依賴的package包/類
public static WritableMap convert(Output output) {
    WritableNativeMap shapeMap = new WritableNativeMap();
    shapeMap.putInt("numDimensions", output.shape().numDimensions());

    WritableNativeMap map = new WritableNativeMap();
    map.putInt("index", output.index());
    map.putString("dataType", output.dataType().name());
    map.putMap("shape", shapeMap);

    return map;
}
 
開發者ID:reneweb,項目名稱:react-native-tensorflow,代碼行數:12,代碼來源:OutputConverter.java

示例5: testArrayWithMaps

import com.facebook.react.bridge.WritableNativeMap; //導入方法依賴的package包/類
public void testArrayWithMaps() {
  WritableNativeMap m1 = new WritableNativeMap();
  WritableNativeMap m2 = new WritableNativeMap();
  m1.putString("m1k1", "m1v1");
  m1.putString("m1k2", "m1v2");
  m2.putString("m2k1", "m2v1");

  WritableNativeArray array = new WritableNativeArray();
  array.pushMap(m1);
  array.pushMap(m2);
  mInstance.getJSModule(TestJavaToJSArgumentsModule.class).receiveArrayWithMaps(array);
  waitForBridgeAndUIIdle();
  mAssertModule.verifyAssertsAndReset();
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:15,代碼來源:CatalystNativeJavaToJSArgumentsTestCase.java

示例6: testMapWithBasicTypes

import com.facebook.react.bridge.WritableNativeMap; //導入方法依賴的package包/類
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();
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:12,代碼來源:CatalystNativeJavaToJSArgumentsTestCase.java

示例7: testNestedMap

import com.facebook.react.bridge.WritableNativeMap; //導入方法依賴的package包/類
public void testNestedMap() {
  WritableNativeMap map = new WritableNativeMap();
  WritableNativeMap nestedMap = new WritableNativeMap();
  nestedMap.putString("animals", "foxes");
  map.putMap("nestedMap", nestedMap);

  mInstance.getJSModule(TestJavaToJSArgumentsModule.class).receiveNestedMap(map);
  waitForBridgeAndUIIdle();
  mAssertModule.verifyAssertsAndReset();
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:11,代碼來源:CatalystNativeJavaToJSArgumentsTestCase.java


注:本文中的com.facebook.react.bridge.WritableNativeMap.putString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。