mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Format Java code in xplat/js/react-native-github
Summary: This diff formats the Java class files inside xplat/js/react-native-github. Since google-java-format was enabled in D16071401 we want to codemode the existing code so that users don't have to deal with formatter lint noise at diff-time. ```arc f --paths-cmd 'hg files -I "**/*.java"'``` drop-conflicts Reviewed By: cpojer Differential Revision: D16071725 fbshipit-source-id: fc6e3852e45742c109f0c5ac4065d64201c74204
This commit is contained in:
committed by
Facebook Github Bot
parent
61e95e5cbf
commit
6c0f73b322
@@ -1,39 +1,35 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import android.view.View;
|
||||
import com.facebook.react.bridge.Dynamic;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.Dynamic;
|
||||
|
||||
/**
|
||||
* Wrapper for {@link ReadableMap} which should be used for styles property map. It extends
|
||||
* some of the accessor methods of {@link ReadableMap} by adding a default value property
|
||||
* such that caller is enforced to provide a default value for a style property.
|
||||
* Wrapper for {@link ReadableMap} which should be used for styles property map. It extends some of
|
||||
* the accessor methods of {@link ReadableMap} by adding a default value property such that caller
|
||||
* is enforced to provide a default value for a style property.
|
||||
*
|
||||
* Instances of this class are used to update {@link View} or {@link CSSNode} style properties.
|
||||
* Since properties are generated by React framework based on what has been updated each value
|
||||
* in this map should either be interpreted as a new value set for a style property or as a "reset
|
||||
* this property to default" command in case when value is null (this is a way React communicates
|
||||
* change in which the style key that was previously present in a map has been removed).
|
||||
* <p>Instances of this class are used to update {@link View} or {@link CSSNode} style properties.
|
||||
* Since properties are generated by React framework based on what has been updated each value in
|
||||
* this map should either be interpreted as a new value set for a style property or as a "reset this
|
||||
* property to default" command in case when value is null (this is a way React communicates change
|
||||
* in which the style key that was previously present in a map has been removed).
|
||||
*
|
||||
* NOTE: Accessor method with default value will throw an exception when the key is not present in
|
||||
* the map. Style applicator logic should verify whether the key exists in the map using
|
||||
* {@link #hasKey} before fetching the value. The motivation behind this is that in case when the
|
||||
* updated style diff map doesn't contain a certain style key it means that the corresponding view
|
||||
* property shouldn't be updated (whereas in all other cases it should be updated to the new value
|
||||
* or the property should be reset).
|
||||
* <p>NOTE: Accessor method with default value will throw an exception when the key is not present
|
||||
* in the map. Style applicator logic should verify whether the key exists in the map using {@link
|
||||
* #hasKey} before fetching the value. The motivation behind this is that in case when the updated
|
||||
* style diff map doesn't contain a certain style key it means that the corresponding view property
|
||||
* shouldn't be updated (whereas in all other cases it should be updated to the new value or the
|
||||
* property should be reset).
|
||||
*/
|
||||
public class ReactStylesDiffMap {
|
||||
|
||||
@@ -43,7 +39,7 @@ public class ReactStylesDiffMap {
|
||||
mBackingMap = props;
|
||||
}
|
||||
|
||||
public Map<String, Object> toMap () {
|
||||
public Map<String, Object> toMap() {
|
||||
return mBackingMap.toHashMap();
|
||||
}
|
||||
|
||||
@@ -64,8 +60,9 @@ public class ReactStylesDiffMap {
|
||||
}
|
||||
|
||||
public float getFloat(String name, float restoreNullToDefaultValue) {
|
||||
return mBackingMap.isNull(name) ?
|
||||
restoreNullToDefaultValue : (float) mBackingMap.getDouble(name);
|
||||
return mBackingMap.isNull(name)
|
||||
? restoreNullToDefaultValue
|
||||
: (float) mBackingMap.getDouble(name);
|
||||
}
|
||||
|
||||
public int getInt(String name, int restoreNullToDefaultValue) {
|
||||
|
||||
Reference in New Issue
Block a user