本文整理汇总了Java中com.facebook.react.bridge.WritableNativeArray.pushDouble方法的典型用法代码示例。如果您正苦于以下问题:Java WritableNativeArray.pushDouble方法的具体用法?Java WritableNativeArray.pushDouble怎么用?Java WritableNativeArray.pushDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.react.bridge.WritableNativeArray
的用法示例。
在下文中一共展示了WritableNativeArray.pushDouble方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMapWithArrays
import com.facebook.react.bridge.WritableNativeArray; //导入方法依赖的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();
}
示例2: makeNativeArray
import com.facebook.react.bridge.WritableNativeArray; //导入方法依赖的package包/类
/**
* This method converts a List into a NativeArray. The data types supported
* are boolean, int, float, double, and String. List, Map, and Bundle
* objects, as well as arrays, containing values of the above types and/or
* null, or any recursive arrangement of these, are also supported. The best
* way to think of this is a way to generate a Java representation of a json
* list, from Java types which have a natural representation in json.
*/
public static WritableNativeArray makeNativeArray(List objects) {
WritableNativeArray nativeArray = new WritableNativeArray();
if (objects == null) {
return nativeArray;
}
for (Object elem : objects) {
elem = makeNativeObject(elem);
if (elem == null) {
nativeArray.pushNull();
} else if (elem instanceof Boolean) {
nativeArray.pushBoolean((Boolean) elem);
} else if (elem instanceof Integer) {
nativeArray.pushInt((Integer) elem);
} else if (elem instanceof Double) {
nativeArray.pushDouble((Double) elem);
} else if (elem instanceof String) {
nativeArray.pushString((String) elem);
} else if (elem instanceof WritableNativeArray) {
nativeArray.pushArray((WritableNativeArray) elem);
} else if (elem instanceof WritableNativeMap) {
nativeArray.pushMap((WritableNativeMap) elem);
} else {
throw new IllegalArgumentException("Could not convert " + elem.getClass());
}
}
return nativeArray;
}
示例3: testArrayWithBasicTypes
import com.facebook.react.bridge.WritableNativeArray; //导入方法依赖的package包/类
public void testArrayWithBasicTypes() {
WritableNativeArray array = new WritableNativeArray();
array.pushString("red panda");
array.pushDouble(1.19);
array.pushBoolean(true);
array.pushNull();
mInstance.getJSModule(TestJavaToJSArgumentsModule.class).receiveArrayWithBasicTypes(array);
waitForBridgeAndUIIdle();
mAssertModule.verifyAssertsAndReset();
}