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


Java WritableNativeMap.putMap方法代碼示例

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


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

示例1: attachMeasuredRootViewToInstance

import com.facebook.react.bridge.WritableNativeMap; //導入方法依賴的package包/類
private void attachMeasuredRootViewToInstance(
    ReactRootView rootView,
    CatalystInstance catalystInstance) {
  Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "attachMeasuredRootViewToInstance");
  UiThreadUtil.assertOnUiThread();

  // Reset view content as it's going to be populated by the application content from JS
  rootView.removeAllViews();
  rootView.setId(View.NO_ID);

  UIManagerModule uiManagerModule = catalystInstance.getNativeModule(UIManagerModule.class);
  int rootTag = uiManagerModule.addMeasuredRootView(rootView);
  rootView.setRootViewTag(rootTag);
  @Nullable Bundle launchOptions = rootView.getLaunchOptions();
  WritableMap initialProps = Arguments.makeNativeMap(launchOptions);
  String jsAppModuleName = rootView.getJSModuleName();

  WritableNativeMap appParams = new WritableNativeMap();
  appParams.putDouble("rootTag", rootTag);
  appParams.putMap("initialProps", initialProps);
  catalystInstance.getJSModule(AppRegistry.class).runApplication(jsAppModuleName, appParams);
  rootView.onAttachedToReactInstance();
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:25,代碼來源:ReactInstanceManager.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: 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

示例6: testThrowWhenMapReusedInMap

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


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