当前位置: 首页>>代码示例>>Java>>正文


Java WritableNativeArray.pushDouble方法代码示例

本文整理汇总了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();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:17,代码来源:CatalystNativeJavaToJSArgumentsTestCase.java

示例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;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:36,代码来源:Arguments.java

示例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();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:12,代码来源:CatalystNativeJavaToJSArgumentsTestCase.java


注:本文中的com.facebook.react.bridge.WritableNativeArray.pushDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。