com.facebook.react.bridge.ReadableMap#getBoolean ( )源码实例Demo

下面列出了com.facebook.react.bridge.ReadableMap#getBoolean ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: google-signin   文件: RNGoogleSigninModule.java
@ReactMethod
public void configure(
        final ReadableMap config,
        final Promise promise
) {
    final ReadableArray scopes = config.hasKey("scopes") ? config.getArray("scopes") : Arguments.createArray();
    final String webClientId = config.hasKey("webClientId") ? config.getString("webClientId") : null;
    final boolean offlineAccess = config.hasKey("offlineAccess") && config.getBoolean("offlineAccess");
    final boolean forceCodeForRefreshToken = config.hasKey("forceCodeForRefreshToken") && config.getBoolean("forceCodeForRefreshToken");
    final String accountName = config.hasKey("accountName") ? config.getString("accountName") : null;
    final String hostedDomain = config.hasKey("hostedDomain") ? config.getString("hostedDomain") : null;

    GoogleSignInOptions options = getSignInOptions(createScopesArray(scopes), webClientId, offlineAccess, forceCodeForRefreshToken, accountName, hostedDomain);
    _apiClient = GoogleSignIn.getClient(getReactApplicationContext(), options);
    promise.resolve(null);
}
 
/**
 * 是否启用自动刷新
 * @param view
 * @param autoRefresh
 */
@ReactProp(name = "autoRefresh",defaultBoolean = false)
public void setAutoRefresh(ReactSmartRefreshLayout view, ReadableMap autoRefresh){
    boolean isAutoRefresh=false;Integer time=null;
    if(autoRefresh.hasKey("refresh")){
        isAutoRefresh=autoRefresh.getBoolean("refresh");
    }
    if(autoRefresh.hasKey("time")){
        time=autoRefresh.getInt("time");
    }
    if(isAutoRefresh==true){
        if(time!=null && time>0){
            view.autoRefresh(time);
        }else{
            view.autoRefresh();
        }
    }
}
 
源代码3 项目: react-native-tcp-socket   文件: TcpSocketServer.java
public TcpSocketServer(final ConcurrentHashMap<Integer, TcpSocketClient> socketClients, final TcpReceiverTask.OnDataReceivedListener receiverListener, final Integer id,
                       final ReadableMap options) throws IOException {
    super(id);
    // Get data from options
    int port = options.getInt("port");
    String address = options.getString("host");
    this.socketClients = socketClients;
    clientSocketIds = (1 + getId()) * 1000;
    // Get the addresses
    InetAddress localInetAddress = InetAddress.getByName(address);
    // Create the socket
    serverSocket = new ServerSocket(port, 50, localInetAddress);
    // setReuseAddress
    try {
        boolean reuseAddress = options.getBoolean("reuseAddress");
        serverSocket.setReuseAddress(reuseAddress);
    } catch (Exception e) {
        // Default to true
        serverSocket.setReuseAddress(true);
    }
    mReceiverListener = receiverListener;
    listen();
}
 
源代码4 项目: react-native-GPay   文件: ReactToolbar.java
void setActions(@Nullable ReadableArray actions) {
  Menu menu = getMenu();
  menu.clear();
  mActionsHolder.clear();
  if (actions != null) {
    for (int i = 0; i < actions.size(); i++) {
      ReadableMap action = actions.getMap(i);

      MenuItem item = menu.add(Menu.NONE, Menu.NONE, i, action.getString(PROP_ACTION_TITLE));

      if (action.hasKey(PROP_ACTION_ICON)) {
        setMenuItemIcon(item, action.getMap(PROP_ACTION_ICON));
      }

      int showAsAction = action.hasKey(PROP_ACTION_SHOW)
          ? action.getInt(PROP_ACTION_SHOW)
          : MenuItem.SHOW_AS_ACTION_NEVER;
      if (action.hasKey(PROP_ACTION_SHOW_WITH_TEXT) &&
          action.getBoolean(PROP_ACTION_SHOW_WITH_TEXT)) {
        showAsAction = showAsAction | MenuItem.SHOW_AS_ACTION_WITH_TEXT;
      }
      item.setShowAsAction(showAsAction);
    }
  }
}
 
源代码5 项目: react-native-GPay   文件: SpringAnimation.java
@Override
public void resetConfig(ReadableMap config) {
  mSpringStiffness = config.getDouble("stiffness");
  mSpringDamping = config.getDouble("damping");
  mSpringMass = config.getDouble("mass");
  mInitialVelocity = mCurrentState.velocity;
  mEndValue = config.getDouble("toValue");
  mRestSpeedThreshold = config.getDouble("restSpeedThreshold");
  mDisplacementFromRestThreshold = config.getDouble("restDisplacementThreshold");
  mOvershootClampingEnabled = config.getBoolean("overshootClamping");
  mIterations = config.hasKey("iterations") ? config.getInt("iterations") : 1;
  mHasFinished = mIterations == 0;
  mCurrentLoop = 0;
  mTimeAccumulator = 0;
  mSpringStarted = false;
}
 
public void showCallout(ReadableMap args) {
    ReadableMap rawPoint = args.getMap("point");
    if (!rawPoint.hasKey("latitude") || !rawPoint.hasKey("longitude")) {
        return;
    }
    Double latitude = rawPoint.getDouble("latitude");
    Double longitude = rawPoint.getDouble("longitude");
    if (latitude == 0 || longitude == 0) {
        return;
    }
    String title = "";
    String text = "";
    Boolean shouldRecenter = false;

    if(args.hasKey("title")) {
        title = args.getString("title");
    }
    if(args.hasKey("text")) {
        text = args.getString("text");
    }
    if(args.hasKey("shouldRecenter")) {
        shouldRecenter = args.getBoolean("shouldRecenter");
    }

    // Displaying the callout
    Point agsPoint = new Point(longitude, latitude, SpatialReferences.getWgs84());

    // Set callout content
    View calloutContent = callout.getContent();
    ((TextView) calloutContent.findViewById(R.id.title)).setText(title);
    ((TextView) calloutContent.findViewById(R.id.text)).setText(text);
    callout.setLocation(agsPoint);
    callout.show();
    Log.i("AGS",callout.isShowing()+" " + calloutContent.getWidth() + " " + calloutContent.getHeight());
    if (shouldRecenter) {
        mapView.setViewpointCenterAsync(agsPoint);
    }
}
 
private void openFilePicker(final ReadableMap props, final Callback onDone, final Callback onCancel) {
  MaterialFilePicker picker = new MaterialFilePicker();
  picker = picker.withActivity(getCurrentActivity());
  picker = picker.withRequestCode(1);

  String filter = props.getString("filter");
  boolean filterDirectories = props.getBoolean("filterDirectories");
  String path = props.getString("path");
  boolean hiddenFiles = props.getBoolean("hiddenFiles");
  boolean closeMenu = props.getBoolean("closeMenu");
  String title = props.getString("title");

  if (filter.length() > 0) {
    picker = picker.withFilter(Pattern.compile(filter));
  }

  picker = picker.withFilterDirectories(filterDirectories);

  if (path.length() > 0) {
    picker = picker.withRootPath(path);
  }

  picker = picker.withHiddenFiles(hiddenFiles);
  picker = picker.withCloseMenu(closeMenu);

  picker = picker.withTitle(title);

  this.onDone = onDone;
  this.onCancel = onCancel;

  picker.start();
}
 
public void makeTabItem(
      ReactBottomNavigation bottomNavigation,
      Menu menu,
      int index,
      Integer itemId,
      ReadableMap config
  ) {

    Log.d(TAG, "makeTabItem");

    MenuItem item = menu.add(
        Menu.NONE,
        itemId,
        Menu.NONE,
        config.getString("title")
    );

    if (config.hasKey("image")) {
      bottomNavigation.setMenuItemIcon(item, config.getMap("image"));
    } else {
      // TODO(lmr): this probably isn't the best default.
      item.setIcon(android.R.drawable.btn_radio);
    }

    if (config.hasKey("enabled")) {
      boolean enabled = config.getBoolean("enabled");
      item.setEnabled(enabled);
    }

    // not sure if we want/need to set anything on the itemview itself. hacky.
//    BottomNavigationMenuView menuView = (BottomNavigationMenuView) bottomNavigation.getChildAt(0);
//    BottomNavigationItemView itemView = (BottomNavigationItemView)menuView.getChildAt(index);
  }
 
源代码9 项目: imsdk-android   文件: QimRNBModule.java
/**
 * 群角色管理
 * @param params
 * @param callback
 */
@ReactMethod
public void setGroupAdmin(ReadableMap params, Callback callback){
    Logger.i("setGroupAdmin:" + params.toString());
    String groupId = params.getString("groupId");
    String xmppid = params.getString("xmppid");
    String name = params.getString("name");
    boolean isAdmin = params.getBoolean("isAdmin");
    ConnectionUtil.getInstance().setGroupAdmin(groupId,xmppid,name,isAdmin);
}
 
public static @Nullable Boolean getBoolean(@NonNull ReadableMap map, @NonNull String key) {
    if (!map.hasKey(key)) {
        return null;
    }

    return map.getBoolean(key);
}
 
@ReactProp(name = PROP_SOURCE)
public void setPath(final VLCPlayerView playerView, ReadableMap map) {
    String path = map.getString("uri");
    boolean autoPlay = map.getBoolean("autoplay");
    playerView.setAutoPlay(autoPlay);
    playerView.setFilePath(path);
}
 
private boolean addTabs(TabLayoutView view, ReadableArray tabsSettings) {
	if (view != null) {
		if (tabsSettings != null) {
			ReadableMap tabSettingsMap = null;

			view.removeAllTabs();
			for (int i = 0; i < tabsSettings.size(); i++) {
				tabSettingsMap = tabsSettings.getMap(i);
				if (tabSettingsMap != null) {
					if (tabSettingsMap.hasKey("customView")) {
						boolean customView = tabSettingsMap.getBoolean("customView");
						if (customView) {
							view.attachCustomTab(tabSettingsMap);
						} else {
							view.attachTab(tabSettingsMap);
						}
					}
				} else {
					return false;
				}
			}

			return true;
		}
	}

	return false;
}
 
源代码13 项目: react-native-android-fragment   文件: ReactUtil.java
/**
 * toObject extracts a value from a {@link ReadableMap} by its key,
 * and returns a POJO representing that object.
 *
 * @param readableMap The Map to containing the value to be converted
 * @param key         The key for the value to be converted
 * @return The converted POJO
 */
public static Object toObject(@Nullable ReadableMap readableMap, String key) {
    if (readableMap == null) {
        return null;
    }

    Object result;

    ReadableType readableType = readableMap.getType(key);
    switch (readableType) {
        case Null:
            result = key;
            break;
        case Boolean:
            result = readableMap.getBoolean(key);
            break;
        case Number:
            // Can be int or double.
            double tmp = readableMap.getDouble(key);
            if (tmp == (int) tmp) {
                result = (int) tmp;
            } else {
                result = tmp;
            }
            break;
        case String:
            result = readableMap.getString(key);
            break;
        case Map:
            result = toMap(readableMap.getMap(key));
            break;
        case Array:
            result = toList(readableMap.getArray(key));
            break;
        default:
            throw new IllegalArgumentException("Could not convert object with key: " + key + ".");
    }

    return result;
}
 
源代码14 项目: react-native-gps   文件: RNLocationModule.java
private static LocationOptions fromReactMap(ReadableMap map) {
  // precision might be dropped on timeout (double -> int conversion), but that's OK
  long timeout =
    map.hasKey("timeout") ? (long) map.getDouble("timeout") : Long.MAX_VALUE;
  double maximumAge =
    map.hasKey("maximumAge") ? map.getDouble("maximumAge") : Double.POSITIVE_INFINITY;
  boolean highAccuracy = !map.hasKey("enableHighAccuracy") || map.getBoolean("enableHighAccuracy");
  float distanceFilter = map.hasKey("distanceFilter") ?
    (float) map.getDouble("distanceFilter") :
    RCT_DEFAULT_LOCATION_ACCURACY;

  return new LocationOptions(timeout, maximumAge, highAccuracy, distanceFilter);
}
 
private void reconcileStatusBarStyle(
    Activity activity,
    ReadableMap prev,
    ReadableMap next,
    boolean firstCall
) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    reconcileStatusBarStyleOnM(
        activity,
        prev,
        next,
        firstCall
    );
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    reconcileStatusBarStyleOnLollipop(
        activity,
        prev,
        next,
        firstCall
    );
  }

  if (firstCall || boolHasChanged("statusBarHidden", prev, next)) {
    boolean hidden = false;
    if (next.hasKey("statusBarHidden")) {
      hidden = next.getBoolean("statusBarHidden");
    }
    if (hidden) {
      activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
      activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    } else {
      activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
      activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
  }
}
 
源代码16 项目: react-native-pili   文件: PiliPlayerViewManager.java
@ReactProp(name = "source")
    public void setSource(PLVideoView mVideoView, ReadableMap source) {
        AVOptions options = new AVOptions();
        String uri = source.getString("uri");
        boolean mediaController = source.hasKey("controller") && source.getBoolean("controller");
        int avFrameTimeout = source.hasKey("timeout") ? source.getInt("timeout") : -1;        //10 * 1000 ms
        boolean liveStreaming = source.hasKey("live") && source.getBoolean("live");  //1 or 0 // 1 -> live
        boolean codec = source.hasKey("hardCodec") && source.getBoolean("hardCodec");  //1 or 0  // 1 -> hw codec enable, 0 -> disable [recommended]
        // the unit of timeout is ms
        if (avFrameTimeout >= 0) {
            options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, avFrameTimeout);
        }
        // Some optimization with buffering mechanism when be set to 1
        if (liveStreaming) {
            options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
        } else {
            options.setInteger(AVOptions.KEY_LIVE_STREAMING, 0);
        }
//        }

        // 1 -> hw codec enable, 0 -> disable [recommended]
        if (codec) {
            options.setInteger(AVOptions.KEY_MEDIACODEC, 1);
        } else {
            options.setInteger(AVOptions.KEY_MEDIACODEC, 0);
        }

        mVideoView.setAVOptions(options);

        // After setVideoPath, the play will start automatically
        // mVideoView.start() is not required

        mVideoView.setVideoPath(uri);

//        if (mediaController) {
//            // You can also use a custom `MediaController` widget
//            MediaController mMediaController = new MediaController(reactContext, false, isLiveStreaming(uri));
//            mVideoView.setMediaController(mMediaController);
//        }

    }
 
源代码17 项目: imsdk-android   文件: QTalkSearchCheckUpdate.java
@ReactMethod
public void update(
        ReadableMap param,
        final Callback callback) {

    WritableNativeMap map = new WritableNativeMap();
    //  @{@"is_ok": @YES, @"errorMsg": @""};
    boolean is_ok = false;

    Activity activity =  getCurrentActivity();
    if(activity != null) {
        // TODO get param
        String fullpackageUrl = param.getString("bundleUrl");
        String fullpackageMd5 = param.getString("zipMd5");
        String patchUrl = param.getString("patchUrl");
        String patchMd5 = param.getString("patchMd5");
        String fullMd5 = param.getString("bundleMd5");
        String bundleName = param.getString("bundleName");

        // TODO switch update type
        if(param.getBoolean("new")){
            String updateType = param.getString("update_type");
            if(updateType.equalsIgnoreCase(FULL_UPDATE)){
                // todo full update
                is_ok = QTalkPatchDownloadHelper.downloadFullPackageAndCheck(fullpackageUrl,
                        fullpackageMd5, bundleName, QTalkSearchRNViewInstanceManager.JS_BUNDLE_NAME_ZIP_NAME,
                        QTalkSearchRNViewInstanceManager.getLocalBundlePath(activity),
                        QTalkSearchRNViewInstanceManager.CACHE_BUNDLE_NAME);

            } else if(updateType.equalsIgnoreCase(PATCH_UPDATE)) {
                // todo patch update
                is_ok = QTalkPatchDownloadHelper.downloadPatchAndCheck(patchUrl,
                        patchMd5, fullMd5,
                        QTalkSearchRNViewInstanceManager.getLocalBundlePath(activity),
                        QTalkSearchRNViewInstanceManager.CACHE_BUNDLE_NAME,
                        QTalkSearchRNViewInstanceManager.JS_BUNDLE_NAME);
            } else if(updateType.equalsIgnoreCase(AUTO_UPDATE)){
                // todo auto update
                // first patch, if patch error full update
                is_ok = QTalkPatchDownloadHelper.downloadPatchAndCheck(patchUrl,
                        patchMd5, fullMd5,
                        QTalkSearchRNViewInstanceManager.getLocalBundlePath(activity),
                        QTalkSearchRNViewInstanceManager.CACHE_BUNDLE_NAME,
                        QTalkSearchRNViewInstanceManager.JS_BUNDLE_NAME);
                if(!is_ok){
                    is_ok = QTalkPatchDownloadHelper.downloadFullPackageAndCheck(fullpackageUrl,
                            fullpackageMd5, bundleName,
                            QTalkSearchRNViewInstanceManager.JS_BUNDLE_NAME_ZIP_NAME,
                            QTalkSearchRNViewInstanceManager.getLocalBundlePath(activity),
                            QTalkSearchRNViewInstanceManager.CACHE_BUNDLE_NAME);
                }

            }
        }
    }

    map.putBoolean("is_ok", is_ok);
    map.putString("errorMsg", "");

    if(is_ok){
        CommonConfig.mainhandler.post(new Runnable() {
            @Override
            public void run() {
                QTalkSearchActivity.clearBridge();
            }
        });
    }

    callback.invoke(map);
}
 
源代码18 项目: react-native-appmetrica   文件: Utils.java
static YandexMetricaConfig toYandexMetricaConfig(ReadableMap configMap) {
    YandexMetricaConfig.Builder builder = YandexMetricaConfig.newConfigBuilder(configMap.getString("apiKey"));

    if (configMap.hasKey("appVersion")) {
        builder.withAppVersion(configMap.getString("appVersion"));
    }
    if (configMap.hasKey("crashReporting")) {
        builder.withCrashReporting(configMap.getBoolean("crashReporting"));
    }
    if (configMap.hasKey("firstActivationAsUpdate")) {
        builder.handleFirstActivationAsUpdate(configMap.getBoolean("firstActivationAsUpdate"));
    }
    if (configMap.hasKey("installedAppCollecting")) {
        builder.withInstalledAppCollecting(configMap.getBoolean("installedAppCollecting"));
    }
    if (configMap.hasKey("location")) {
        builder.withLocation(toLocation(configMap.getMap("location")));
    }
    if (configMap.hasKey("locationTracking")) {
        builder.withLocationTracking(configMap.getBoolean("locationTracking"));
    }
    if (configMap.hasKey("logs") && configMap.getBoolean("logs")) {
        builder.withLogs();
    }
    if (configMap.hasKey("maxReportsInDatabaseCount")) {
        builder.withMaxReportsInDatabaseCount(configMap.getInt("maxReportsInDatabaseCount"));
    }
    if (configMap.hasKey("nativeCrashReporting")) {
        builder.withNativeCrashReporting(configMap.getBoolean("nativeCrashReporting"));
    }
    if (configMap.hasKey("preloadInfo")) {
        builder.withPreloadInfo(toPreloadInfo(configMap.getMap("preloadInfo")));
    }
    if (configMap.hasKey("sessionTimeout")) {
        builder.withSessionTimeout(configMap.getInt("sessionTimeout"));
    }
    if (configMap.hasKey("statisticsSending")) {
        builder.withStatisticsSending(configMap.getBoolean("statisticsSending"));
    }

    return builder.build();
}
 
@ReactMethod
public void register(ReadableMap config, Promise promise) {
    ReactNativeNotificationHubUtil notificationHubUtil = ReactNativeNotificationHubUtil.getInstance();
    String connectionString = config.getString(KEY_REGISTRATION_CONNECTIONSTRING);
    if (connectionString == null) {
        promise.reject(ERROR_INVALID_ARGUMENTS, ERROR_INVALID_CONNECTION_STRING);
        return;
    }

    String hubName = config.getString(KEY_REGISTRATION_HUBNAME);
    if (hubName == null) {
        promise.reject(ERROR_INVALID_ARGUMENTS, ERROR_INVALID_HUBNAME);
        return;
    }

    String senderID = config.getString(KEY_REGISTRATION_SENDERID);
    if (senderID == null) {
        promise.reject(ERROR_INVALID_ARGUMENTS, ERROR_INVALID_SENDER_ID);
        return;
    }

    String[] tags = null;
    if (config.hasKey(KEY_REGISTRATION_TAGS) && !config.isNull(KEY_REGISTRATION_TAGS)) {
        ReadableArray tagsJson = config.getArray(KEY_REGISTRATION_TAGS);
        tags = new String[tagsJson.size()];
        for (int i = 0; i < tagsJson.size(); ++i) {
            tags[i] = tagsJson.getString(i);
        }
    }

    ReactContext reactContext = getReactApplicationContext();
    notificationHubUtil.setConnectionString(reactContext, connectionString);
    notificationHubUtil.setHubName(reactContext, hubName);
    notificationHubUtil.setSenderID(reactContext, senderID);
    notificationHubUtil.setTemplated(reactContext, false);
    notificationHubUtil.setTags(reactContext, tags);

    if (config.hasKey(KEY_REGISTRATION_CHANNELNAME)) {
        String channelName = config.getString(KEY_REGISTRATION_CHANNELNAME);
        notificationHubUtil.setChannelName(reactContext, channelName);
    }

    if (config.hasKey(KEY_REGISTRATION_CHANNELDESCRIPTION)) {
        String channelDescription = config.getString(KEY_REGISTRATION_CHANNELDESCRIPTION);
        notificationHubUtil.setChannelDescription(reactContext, channelDescription);
    }

    if (config.hasKey(KEY_REGISTRATION_CHANNELIMPORTANCE)) {
        int channelImportance = config.getInt(KEY_REGISTRATION_CHANNELIMPORTANCE);
        notificationHubUtil.setChannelImportance(reactContext, channelImportance);
    }

    if (config.hasKey(KEY_REGISTRATION_CHANNELSHOWBADGE)) {
        boolean channelShowBadge = config.getBoolean(KEY_REGISTRATION_CHANNELSHOWBADGE);
        notificationHubUtil.setChannelShowBadge(reactContext, channelShowBadge);
    }

    if (config.hasKey(KEY_REGISTRATION_CHANNELENABLELIGHTS)) {
        boolean channelEnableLights = config.getBoolean(KEY_REGISTRATION_CHANNELENABLELIGHTS);
        notificationHubUtil.setChannelEnableLights(reactContext, channelEnableLights);
    }

    if (config.hasKey(KEY_REGISTRATION_CHANNELENABLEVIBRATION)) {
        boolean channelEnableVibration = config.getBoolean(KEY_REGISTRATION_CHANNELENABLEVIBRATION);
        notificationHubUtil.setChannelEnableVibration(reactContext, channelEnableVibration);
    }

    String uuid = notificationHubUtil.getUUID(reactContext);
    if (uuid == null) {
        uuid = ReactNativeUtil.genUUID();
        notificationHubUtil.setUUID(reactContext, uuid);
    }

    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = apiAvailability.isGooglePlayServicesAvailable(reactContext);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
            UiThreadUtil.runOnUiThread(
                    new GoogleApiAvailabilityRunnable(
                            getCurrentActivity(),
                            apiAvailability,
                            resultCode));
            promise.reject(ERROR_PLAY_SERVICES, ERROR_PLAY_SERVICES_DISABLED);
        } else {
            promise.reject(ERROR_PLAY_SERVICES, ERROR_PLAY_SERVICES_UNSUPPORTED);
        }
        return;
    }

    Intent intent = ReactNativeNotificationHubUtil.IntentFactory.createIntent(
            reactContext, ReactNativeRegistrationIntentService.class);
    ReactNativeRegistrationIntentService.enqueueWork(reactContext, intent);

    WritableMap res = Arguments.createMap();
    res.putString(KEY_PROMISE_RESOLVE_UUID, uuid);
    promise.resolve(res);
}
 
protected void setYAxisConfig(YAxis axis, ReadableMap propMap) {
    if (BridgeUtils.validate(propMap, ReadableType.Number, "axisMaxValue")) {
        axis.setAxisMaxValue((float) propMap.getDouble("axisMaxValue"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Number, "axisMinValue")) {
        axis.setAxisMinValue((float) propMap.getDouble("axisMinValue"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Boolean, "inverted")) {
        axis.setInverted(propMap.getBoolean("inverted"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Number, "spaceTop")) {
        axis.setSpaceTop((float) propMap.getDouble("spaceTop"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Number, "spaceBottom")) {
        axis.setSpaceBottom((float) propMap.getDouble("spaceBottom"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Boolean, "showOnlyMinMax")) {
        axis.setShowOnlyMinMax(propMap.getBoolean("showOnlyMinMax"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Number, "labelCount")) {
        boolean labelCountForce = false;
        if (BridgeUtils.validate(propMap, ReadableType.Boolean, "labelCountForce")) {
            labelCountForce = propMap.getBoolean("labelCountForce");
        }
        axis.setLabelCount(propMap.getInt("labelCount"), labelCountForce);
    }
    if (BridgeUtils.validate(propMap, ReadableType.String, "position")) {
        axis.setPosition(YAxis.YAxisLabelPosition.valueOf(propMap.getString("position")));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Number, "granularity")) {
        axis.setGranularity((float) propMap.getDouble("granularity"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Boolean, "granularityEnabled")) {
        axis.setGranularityEnabled(propMap.getBoolean("granularityEnabled"));
    }


    // formatting
    if (BridgeUtils.validate(propMap, ReadableType.String, "valueFormatter")) {
        String valueFormatter = propMap.getString("valueFormatter");

        if ("largeValue".equals(valueFormatter)) {
            axis.setValueFormatter(new LargeValueFormatter());
        } else if ("percent".equals(valueFormatter)) {
            axis.setValueFormatter(new PercentFormatter());
        } else {
            axis.setValueFormatter(new CustomFormatter(valueFormatter));
        }
    }

    // TODO docs says the remaining config needs to be applied before setting data. Test it
    // zero line
    if (BridgeUtils.validate(propMap, ReadableType.Map, "zeroLine")) {
        ReadableMap zeroLineConfig = propMap.getMap("zeroLine");

        if (BridgeUtils.validate(zeroLineConfig, ReadableType.Boolean, "enabled")) {
            axis.setDrawZeroLine(zeroLineConfig.getBoolean("enabled"));
        }
        if (BridgeUtils.validate(zeroLineConfig, ReadableType.Number, "lineWidth")) {
            axis.setZeroLineWidth((float) zeroLineConfig.getDouble("lineWidth"));
        }
        if (BridgeUtils.validate(zeroLineConfig, ReadableType.String, "lineColor")) {
            axis.setZeroLineColor(Color.parseColor(zeroLineConfig.getString("lineColor")));
        }
    }
}