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


Java WritableNativeMap.putArray方法代碼示例

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


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

示例1: 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

示例2: testMapWithArrays

import com.facebook.react.bridge.WritableNativeMap; //導入方法依賴的package包/類
public void testMapWithArrays() {
  WritableNativeMap map = new WritableNativeMap();
  WritableNativeArray a1 = new WritableNativeArray();
  WritableNativeArray a2 = new WritableNativeArray();
  a1.pushDouble(3);
  a1.pushDouble(1);
  a1.pushDouble(4);
  a2.pushDouble(1);
  a2.pushDouble(9);
  map.putArray("array1", a1);
  map.putArray("array2", a2);

  mInstance.getJSModule(TestJavaToJSArgumentsModule.class).receiveMapWithArrays(map);
  waitForBridgeAndUIIdle();
  mAssertModule.verifyAssertsAndReset();
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:17,代碼來源:CatalystNativeJavaToJSArgumentsTestCase.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: testThrowWhenArrayReusedInMap

import com.facebook.react.bridge.WritableNativeMap; //導入方法依賴的package包/類
public void testThrowWhenArrayReusedInMap() {
  boolean gotException = false;
  try {
    WritableNativeMap map1 = new WritableNativeMap();
    WritableNativeMap map2 = new WritableNativeMap();
    WritableNativeArray child = new WritableNativeArray();
    map1.putArray("child", child);
    map2.putArray("child", child);
  } catch (ObjectAlreadyConsumedException e) {
    gotException = true;
  }
  assertTrue(gotException);
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:14,代碼來源:CatalystNativeJavaToJSArgumentsTestCase.java


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