本文整理匯總了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);
}
示例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());
}
}
示例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();
}
示例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;
}
示例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();
}
示例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);
}