mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 12:45:37 +08:00
Export latest Android changes
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 22
|
compileSdkVersion 23
|
||||||
buildToolsVersion "23.0.1"
|
buildToolsVersion "23.0.1"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
@@ -24,11 +24,11 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
compile 'com.android.support:appcompat-v7:22.2.0'
|
compile 'com.android.support:appcompat-v7:23.0.1'
|
||||||
|
|
||||||
// Depend on pre-built React Native
|
// Depend on pre-built React Native
|
||||||
compile 'com.facebook.react:react-native:0.11.+'
|
compile 'com.facebook.react:react-native:0.11.+'
|
||||||
|
|
||||||
// Depend on React Native source.
|
// Depend on React Native source.
|
||||||
// This is useful for testing your changes when working on React Native.
|
// This is useful for testing your changes when working on React Native.
|
||||||
// compile project(':ReactAndroid')
|
// compile project(':ReactAndroid')
|
||||||
|
|||||||
1
Examples/Movies/android/app/gradle.properties
Normal file
1
Examples/Movies/android/app/gradle.properties
Normal file
@@ -0,0 +1 @@
|
|||||||
|
android.useDeprecatedNdk=true
|
||||||
@@ -24,11 +24,11 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
compile 'com.android.support:appcompat-v7:23.0.0'
|
compile 'com.android.support:appcompat-v7:23.0.1'
|
||||||
|
|
||||||
// Depend on pre-built React Native
|
// Depend on pre-built React Native
|
||||||
compile 'com.facebook.react:react-native:0.11.+'
|
compile 'com.facebook.react:react-native:0.11.+'
|
||||||
|
|
||||||
// Depend on React Native source.
|
// Depend on React Native source.
|
||||||
// This is useful for testing your changes when working on React Native.
|
// This is useful for testing your changes when working on React Native.
|
||||||
// compile project(':ReactAndroid')
|
// compile project(':ReactAndroid')
|
||||||
|
|||||||
1
Examples/SampleApp/android/app/gradle.properties
Normal file
1
Examples/SampleApp/android/app/gradle.properties
Normal file
@@ -0,0 +1 @@
|
|||||||
|
android.useDeprecatedNdk=true
|
||||||
@@ -24,11 +24,11 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
compile 'com.android.support:appcompat-v7:23.0.0'
|
compile 'com.android.support:appcompat-v7:23.0.1'
|
||||||
|
|
||||||
// Depend on pre-built React Native
|
// Depend on pre-built React Native
|
||||||
compile 'com.facebook.react:react-native:0.11.+'
|
compile 'com.facebook.react:react-native:0.11.+'
|
||||||
|
|
||||||
// Depend on React Native source.
|
// Depend on React Native source.
|
||||||
// This is useful for testing your changes when working on React Native.
|
// This is useful for testing your changes when working on React Native.
|
||||||
// compile project(':ReactAndroid')
|
// compile project(':ReactAndroid')
|
||||||
|
|||||||
1
Examples/UIExplorer/android/app/gradle.properties
Normal file
1
Examples/UIExplorer/android/app/gradle.properties
Normal file
@@ -0,0 +1 @@
|
|||||||
|
android.useDeprecatedNdk=true
|
||||||
@@ -196,8 +196,8 @@ task packageReactNdkLibs(dependsOn: buildReactNdkLib, type: Copy) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 22
|
compileSdkVersion 23
|
||||||
buildToolsVersion "22.0.1"
|
buildToolsVersion "23.0.1"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
@@ -231,7 +231,7 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
compile 'com.android.support:appcompat-v7:22.2.0'
|
compile 'com.android.support:appcompat-v7:23.0.1'
|
||||||
compile 'com.facebook.fresco:fresco:0.6.1'
|
compile 'com.facebook.fresco:fresco:0.6.1'
|
||||||
compile 'com.facebook.fresco:imagepipeline-okhttp:0.6.1'
|
compile 'com.facebook.fresco:imagepipeline-okhttp:0.6.1'
|
||||||
compile 'com.fasterxml.jackson.core:jackson-core:2.2.3'
|
compile 'com.fasterxml.jackson.core:jackson-core:2.2.3'
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
VERSION_NAME=0.11.1-SNAPSHOT
|
VERSION_NAME=0.12.0-SNAPSHOT
|
||||||
GROUP=com.facebook.react
|
GROUP=com.facebook.react
|
||||||
|
|
||||||
POM_NAME=ReactNative
|
POM_NAME=ReactNative
|
||||||
POM_ARTIFACT_ID=react-native
|
POM_ARTIFACT_ID=react-native
|
||||||
POM_PACKAGING=aar
|
POM_PACKAGING=aar
|
||||||
|
|
||||||
|
android.useDeprecatedNdk=true
|
||||||
|
|||||||
@@ -7,53 +7,54 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// NOTE: this file is auto-copied from https://github.com/facebook/css-layout
|
// NOTE: this file is auto-copied from https://github.com/facebook/css-layout
|
||||||
// @generated SignedSource<<153b6759d2dd8fe8cf6d58a422450b96>>
|
// @generated SignedSource<<638f16255d86b878b0377e1070cc2b44>>
|
||||||
|
|
||||||
package com.facebook.csslayout;
|
package com.facebook.csslayout;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Where the output of {@link LayoutEngine#layoutNode(CSSNode, float)} will go in the CSSNode.
|
* Where the output of {@link LayoutEngine#layoutNode(CSSNode, float)} will go in the CSSNode.
|
||||||
*/
|
*/
|
||||||
public class CSSLayout {
|
public class CSSLayout {
|
||||||
|
public static final int POSITION_LEFT = 0;
|
||||||
|
public static final int POSITION_TOP = 1;
|
||||||
|
public static final int POSITION_RIGHT = 2;
|
||||||
|
public static final int POSITION_BOTTOM = 3;
|
||||||
|
|
||||||
public float top;
|
public static final int DIMENSION_WIDTH = 0;
|
||||||
public float left;
|
public static final int DIMENSION_HEIGHT = 1;
|
||||||
public float right;
|
|
||||||
public float bottom;
|
public float[] position = new float[4];
|
||||||
public float width = CSSConstants.UNDEFINED;
|
public float[] dimensions = new float[2];
|
||||||
public float height = CSSConstants.UNDEFINED;
|
|
||||||
public CSSDirection direction = CSSDirection.LTR;
|
public CSSDirection direction = CSSDirection.LTR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This should always get called before calling {@link LayoutEngine#layoutNode(CSSNode, float)}
|
* This should always get called before calling {@link LayoutEngine#layoutNode(CSSNode, float)}
|
||||||
*/
|
*/
|
||||||
public void resetResult() {
|
public void resetResult() {
|
||||||
left = 0;
|
Arrays.fill(position, 0);
|
||||||
top = 0;
|
Arrays.fill(dimensions, CSSConstants.UNDEFINED);
|
||||||
right = 0;
|
|
||||||
bottom = 0;
|
|
||||||
width = CSSConstants.UNDEFINED;
|
|
||||||
height = CSSConstants.UNDEFINED;
|
|
||||||
direction = CSSDirection.LTR;
|
direction = CSSDirection.LTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copy(CSSLayout layout) {
|
public void copy(CSSLayout layout) {
|
||||||
left = layout.left;
|
position[POSITION_LEFT] = layout.position[POSITION_LEFT];
|
||||||
top = layout.top;
|
position[POSITION_TOP] = layout.position[POSITION_TOP];
|
||||||
right = layout.right;
|
position[POSITION_RIGHT] = layout.position[POSITION_RIGHT];
|
||||||
bottom = layout.bottom;
|
position[POSITION_BOTTOM] = layout.position[POSITION_BOTTOM];
|
||||||
width = layout.width;
|
dimensions[DIMENSION_WIDTH] = layout.dimensions[DIMENSION_WIDTH];
|
||||||
height = layout.height;
|
dimensions[DIMENSION_HEIGHT] = layout.dimensions[DIMENSION_HEIGHT];
|
||||||
direction = layout.direction;
|
direction = layout.direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "layout: {" +
|
return "layout: {" +
|
||||||
"left: " + left + ", " +
|
"left: " + position[POSITION_LEFT] + ", " +
|
||||||
"top: " + top + ", " +
|
"top: " + position[POSITION_TOP] + ", " +
|
||||||
"width: " + width + ", " +
|
"width: " + dimensions[DIMENSION_WIDTH] + ", " +
|
||||||
"height: " + height +
|
"height: " + dimensions[DIMENSION_HEIGHT] + ", " +
|
||||||
"direction: " + direction +
|
"direction: " + direction +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// NOTE: this file is auto-copied from https://github.com/facebook/css-layout
|
// NOTE: this file is auto-copied from https://github.com/facebook/css-layout
|
||||||
// @generated SignedSource<<c3a1298e36789dcda4cc2776d48646a7>>
|
// @generated SignedSource<<560f2fd13ec8e1100a71958529146055>>
|
||||||
|
|
||||||
package com.facebook.csslayout;
|
package com.facebook.csslayout;
|
||||||
|
|
||||||
@@ -17,6 +17,13 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import com.facebook.infer.annotation.Assertions;
|
import com.facebook.infer.annotation.Assertions;
|
||||||
|
|
||||||
|
import static com.facebook.csslayout.CSSLayout.DIMENSION_HEIGHT;
|
||||||
|
import static com.facebook.csslayout.CSSLayout.DIMENSION_WIDTH;
|
||||||
|
import static com.facebook.csslayout.CSSLayout.POSITION_BOTTOM;
|
||||||
|
import static com.facebook.csslayout.CSSLayout.POSITION_LEFT;
|
||||||
|
import static com.facebook.csslayout.CSSLayout.POSITION_RIGHT;
|
||||||
|
import static com.facebook.csslayout.CSSLayout.POSITION_TOP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A CSS Node. It has a style object you can manipulate at {@link #style}. After calling
|
* A CSS Node. It has a style object you can manipulate at {@link #style}. After calling
|
||||||
* {@link #calculateLayout()}, {@link #layout} will be filled with the results of the layout.
|
* {@link #calculateLayout()}, {@link #layout} will be filled with the results of the layout.
|
||||||
@@ -59,6 +66,9 @@ public class CSSNode {
|
|||||||
|
|
||||||
public int lineIndex = 0;
|
public int lineIndex = 0;
|
||||||
|
|
||||||
|
/*package*/ CSSNode nextAbsoluteChild;
|
||||||
|
/*package*/ CSSNode nextFlexChild;
|
||||||
|
|
||||||
private @Nullable ArrayList<CSSNode> mChildren;
|
private @Nullable ArrayList<CSSNode> mChildren;
|
||||||
private @Nullable CSSNode mParent;
|
private @Nullable CSSNode mParent;
|
||||||
private @Nullable MeasureFunction mMeasureFunction = null;
|
private @Nullable MeasureFunction mMeasureFunction = null;
|
||||||
@@ -296,61 +306,61 @@ public class CSSNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setPositionTop(float positionTop) {
|
public void setPositionTop(float positionTop) {
|
||||||
if (!valuesEqual(style.positionTop, positionTop)) {
|
if (!valuesEqual(style.position[POSITION_TOP], positionTop)) {
|
||||||
style.positionTop = positionTop;
|
style.position[POSITION_TOP] = positionTop;
|
||||||
dirty();
|
dirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPositionBottom(float positionBottom) {
|
public void setPositionBottom(float positionBottom) {
|
||||||
if (!valuesEqual(style.positionBottom, positionBottom)) {
|
if (!valuesEqual(style.position[POSITION_BOTTOM], positionBottom)) {
|
||||||
style.positionBottom = positionBottom;
|
style.position[POSITION_BOTTOM] = positionBottom;
|
||||||
dirty();
|
dirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPositionLeft(float positionLeft) {
|
public void setPositionLeft(float positionLeft) {
|
||||||
if (!valuesEqual(style.positionLeft, positionLeft)) {
|
if (!valuesEqual(style.position[POSITION_LEFT], positionLeft)) {
|
||||||
style.positionLeft = positionLeft;
|
style.position[POSITION_LEFT] = positionLeft;
|
||||||
dirty();
|
dirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPositionRight(float positionRight) {
|
public void setPositionRight(float positionRight) {
|
||||||
if (!valuesEqual(style.positionRight, positionRight)) {
|
if (!valuesEqual(style.position[POSITION_RIGHT], positionRight)) {
|
||||||
style.positionRight = positionRight;
|
style.position[POSITION_RIGHT] = positionRight;
|
||||||
dirty();
|
dirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStyleWidth(float width) {
|
public void setStyleWidth(float width) {
|
||||||
if (!valuesEqual(style.width, width)) {
|
if (!valuesEqual(style.dimensions[DIMENSION_WIDTH], width)) {
|
||||||
style.width = width;
|
style.dimensions[DIMENSION_WIDTH] = width;
|
||||||
dirty();
|
dirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStyleHeight(float height) {
|
public void setStyleHeight(float height) {
|
||||||
if (!valuesEqual(style.height, height)) {
|
if (!valuesEqual(style.dimensions[DIMENSION_HEIGHT], height)) {
|
||||||
style.height = height;
|
style.dimensions[DIMENSION_HEIGHT] = height;
|
||||||
dirty();
|
dirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLayoutX() {
|
public float getLayoutX() {
|
||||||
return layout.left;
|
return layout.position[POSITION_LEFT];
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLayoutY() {
|
public float getLayoutY() {
|
||||||
return layout.top;
|
return layout.position[POSITION_TOP];
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLayoutWidth() {
|
public float getLayoutWidth() {
|
||||||
return layout.width;
|
return layout.dimensions[DIMENSION_WIDTH];
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLayoutHeight() {
|
public float getLayoutHeight() {
|
||||||
return layout.height;
|
return layout.dimensions[DIMENSION_HEIGHT];
|
||||||
}
|
}
|
||||||
|
|
||||||
public CSSDirection getLayoutDirection() {
|
public CSSDirection getLayoutDirection() {
|
||||||
@@ -368,14 +378,14 @@ public class CSSNode {
|
|||||||
* Get this node's width, as defined in the style.
|
* Get this node's width, as defined in the style.
|
||||||
*/
|
*/
|
||||||
public float getStyleWidth() {
|
public float getStyleWidth() {
|
||||||
return style.width;
|
return style.dimensions[DIMENSION_WIDTH];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get this node's height, as defined in the style.
|
* Get this node's height, as defined in the style.
|
||||||
*/
|
*/
|
||||||
public float getStyleHeight() {
|
public float getStyleHeight() {
|
||||||
return style.height;
|
return style.dimensions[DIMENSION_HEIGHT];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// NOTE: this file is auto-copied from https://github.com/facebook/css-layout
|
// NOTE: this file is auto-copied from https://github.com/facebook/css-layout
|
||||||
// @generated SignedSource<<ec76950a22dda1c6e98eafc15ccf7cd3>>
|
// @generated SignedSource<<2fc400ad927a17e1b13430210531ce86>>
|
||||||
|
|
||||||
package com.facebook.csslayout;
|
package com.facebook.csslayout;
|
||||||
|
|
||||||
@@ -30,13 +30,17 @@ public class CSSStyle {
|
|||||||
public Spacing padding = new Spacing();
|
public Spacing padding = new Spacing();
|
||||||
public Spacing border = new Spacing();
|
public Spacing border = new Spacing();
|
||||||
|
|
||||||
public float positionTop = CSSConstants.UNDEFINED;
|
public float[] position = {
|
||||||
public float positionBottom = CSSConstants.UNDEFINED;
|
CSSConstants.UNDEFINED,
|
||||||
public float positionLeft = CSSConstants.UNDEFINED;
|
CSSConstants.UNDEFINED,
|
||||||
public float positionRight = CSSConstants.UNDEFINED;
|
CSSConstants.UNDEFINED,
|
||||||
|
CSSConstants.UNDEFINED,
|
||||||
|
};
|
||||||
|
|
||||||
public float width = CSSConstants.UNDEFINED;
|
public float[] dimensions = {
|
||||||
public float height = CSSConstants.UNDEFINED;
|
CSSConstants.UNDEFINED,
|
||||||
|
CSSConstants.UNDEFINED,
|
||||||
|
};
|
||||||
|
|
||||||
public float minWidth = CSSConstants.UNDEFINED;
|
public float minWidth = CSSConstants.UNDEFINED;
|
||||||
public float minHeight = CSSConstants.UNDEFINED;
|
public float minHeight = CSSConstants.UNDEFINED;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
The source of truth for css-layout is: https://github.com/facebook/css-layout
|
The source of truth for css-layout is: https://github.com/facebook/css-layout
|
||||||
|
|
||||||
The code here should be kept in sync with GitHub.
|
The code here should be kept in sync with GitHub.
|
||||||
HEAD at the time this code was synced: https://github.com/facebook/css-layout/commit/7104f7c8eb6c160a8d10badc08f9b981bb65e19c
|
HEAD at the time this code was synced: https://github.com/facebook/css-layout/commit/f51c2d004de7744f9cefb98aa2a9c1c22168d49c
|
||||||
|
|
||||||
There is generated code in:
|
There is generated code in:
|
||||||
- README (this file)
|
- README (this file)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
The source of truth for css-layout is: https://github.com/facebook/css-layout
|
The source of truth for css-layout is: https://github.com/facebook/css-layout
|
||||||
|
|
||||||
The code here should be kept in sync with GitHub.
|
The code here should be kept in sync with GitHub.
|
||||||
HEAD at the time this code was synced: https://github.com/facebook/css-layout/commit/7104f7c8eb6c160a8d10badc08f9b981bb65e19c
|
HEAD at the time this code was synced: https://github.com/facebook/css-layout/commit/f51c2d004de7744f9cefb98aa2a9c1c22168d49c
|
||||||
|
|
||||||
There is generated code in:
|
There is generated code in:
|
||||||
- README.facebook (this file)
|
- README.facebook (this file)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// NOTE: this file is auto-copied from https://github.com/facebook/css-layout
|
// NOTE: this file is auto-copied from https://github.com/facebook/css-layout
|
||||||
// @generated SignedSource<<6853e87a84818f1abb6573aee7d6bd55>>
|
// @generated SignedSource<<fcf3439e46c4c76e42357c348a9ffe99>>
|
||||||
|
|
||||||
package com.facebook.csslayout;
|
package com.facebook.csslayout;
|
||||||
|
|
||||||
@@ -58,8 +58,22 @@ public class Spacing {
|
|||||||
*/
|
*/
|
||||||
public static final int ALL = 8;
|
public static final int ALL = 8;
|
||||||
|
|
||||||
|
private static final int[] sFlagsMap = {
|
||||||
|
1, /*LEFT*/
|
||||||
|
2, /*TOP*/
|
||||||
|
4, /*RIGHT*/
|
||||||
|
8, /*BOTTOM*/
|
||||||
|
16, /*VERTICAL*/
|
||||||
|
32, /*HORIZONTAL*/
|
||||||
|
64, /*START*/
|
||||||
|
128, /*END*/
|
||||||
|
256, /*ALL*/
|
||||||
|
};
|
||||||
|
|
||||||
private final float[] mSpacing = newFullSpacingArray();
|
private final float[] mSpacing = newFullSpacingArray();
|
||||||
@Nullable private float[] mDefaultSpacing = null;
|
@Nullable private float[] mDefaultSpacing = null;
|
||||||
|
private int mValueFlags = 0;
|
||||||
|
private boolean mHasAliasesSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a spacing value.
|
* Set a spacing value.
|
||||||
@@ -73,6 +87,18 @@ public class Spacing {
|
|||||||
public boolean set(int spacingType, float value) {
|
public boolean set(int spacingType, float value) {
|
||||||
if (!FloatUtil.floatsEqual(mSpacing[spacingType], value)) {
|
if (!FloatUtil.floatsEqual(mSpacing[spacingType], value)) {
|
||||||
mSpacing[spacingType] = value;
|
mSpacing[spacingType] = value;
|
||||||
|
|
||||||
|
if (CSSConstants.isUndefined(value)) {
|
||||||
|
mValueFlags &= ~sFlagsMap[spacingType];
|
||||||
|
} else {
|
||||||
|
mValueFlags |= sFlagsMap[spacingType];
|
||||||
|
}
|
||||||
|
|
||||||
|
mHasAliasesSet =
|
||||||
|
(mValueFlags & sFlagsMap[ALL]) != 0 ||
|
||||||
|
(mValueFlags & sFlagsMap[VERTICAL]) != 0 ||
|
||||||
|
(mValueFlags & sFlagsMap[HORIZONTAL]) != 0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -103,18 +129,28 @@ public class Spacing {
|
|||||||
* @param spacingType one of {@link #LEFT}, {@link #TOP}, {@link #RIGHT}, {@link #BOTTOM}
|
* @param spacingType one of {@link #LEFT}, {@link #TOP}, {@link #RIGHT}, {@link #BOTTOM}
|
||||||
*/
|
*/
|
||||||
public float get(int spacingType) {
|
public float get(int spacingType) {
|
||||||
int secondType = spacingType == TOP || spacingType == BOTTOM ? VERTICAL : HORIZONTAL;
|
float defaultValue = (mDefaultSpacing != null)
|
||||||
float defaultValue = spacingType == START || spacingType == END ? CSSConstants.UNDEFINED : 0;
|
? mDefaultSpacing[spacingType]
|
||||||
return
|
: (spacingType == START || spacingType == END ? CSSConstants.UNDEFINED : 0);
|
||||||
!CSSConstants.isUndefined(mSpacing[spacingType])
|
|
||||||
? mSpacing[spacingType]
|
if (mValueFlags == 0) {
|
||||||
: !CSSConstants.isUndefined(mSpacing[secondType])
|
return defaultValue;
|
||||||
? mSpacing[secondType]
|
}
|
||||||
: !CSSConstants.isUndefined(mSpacing[ALL])
|
|
||||||
? mSpacing[ALL]
|
if ((mValueFlags & sFlagsMap[spacingType]) != 0) {
|
||||||
: mDefaultSpacing != null
|
return mSpacing[spacingType];
|
||||||
? mDefaultSpacing[spacingType]
|
}
|
||||||
: defaultValue;
|
|
||||||
|
if (mHasAliasesSet) {
|
||||||
|
int secondType = spacingType == TOP || spacingType == BOTTOM ? VERTICAL : HORIZONTAL;
|
||||||
|
if ((mValueFlags & sFlagsMap[secondType]) != 0) {
|
||||||
|
return mSpacing[secondType];
|
||||||
|
} else if ((mValueFlags & sFlagsMap[ALL]) != 0) {
|
||||||
|
return mSpacing[ALL];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -128,6 +164,18 @@ public class Spacing {
|
|||||||
return mSpacing[spacingType];
|
return mSpacing[spacingType];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to get start value and fallback to given type if not defined. This is used privately
|
||||||
|
* by the layout engine as a more efficient way to fetch direction-aware values by
|
||||||
|
* avoid extra method invocations.
|
||||||
|
*/
|
||||||
|
float getWithFallback(int spacingType, int fallbackType) {
|
||||||
|
return
|
||||||
|
(mValueFlags & sFlagsMap[spacingType]) != 0
|
||||||
|
? mSpacing[spacingType]
|
||||||
|
: get(fallbackType);
|
||||||
|
}
|
||||||
|
|
||||||
private static float[] newFullSpacingArray() {
|
private static float[] newFullSpacingArray() {
|
||||||
return new float[] {
|
return new float[] {
|
||||||
CSSConstants.UNDEFINED,
|
CSSConstants.UNDEFINED,
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ set -e # exit if any command fails
|
|||||||
echo "Making github project..."
|
echo "Making github project..."
|
||||||
pushd $GITHUB
|
pushd $GITHUB
|
||||||
COMMIT_ID=$(git rev-parse HEAD)
|
COMMIT_ID=$(git rev-parse HEAD)
|
||||||
make
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
SRC=$GITHUB/src/java/src/com/facebook/csslayout
|
SRC=$GITHUB/src/java/src/com/facebook/csslayout
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ public interface ReadableArray {
|
|||||||
boolean getBoolean(int index);
|
boolean getBoolean(int index);
|
||||||
double getDouble(int index);
|
double getDouble(int index);
|
||||||
int getInt(int index);
|
int getInt(int index);
|
||||||
|
// Check CatalystStylesDiffMap#getColorInt() to see why this is needed
|
||||||
|
int getColorInt(int index);
|
||||||
String getString(int index);
|
String getString(int index);
|
||||||
ReadableArray getArray(int index);
|
ReadableArray getArray(int index);
|
||||||
ReadableMap getMap(int index);
|
ReadableMap getMap(int index);
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ public interface ReadableMap {
|
|||||||
boolean getBoolean(String name);
|
boolean getBoolean(String name);
|
||||||
double getDouble(String name);
|
double getDouble(String name);
|
||||||
int getInt(String name);
|
int getInt(String name);
|
||||||
|
// Check CatalystStylesDiffMap#getColorInt() to see why this is needed
|
||||||
|
int getColorInt(String name);
|
||||||
String getString(String name);
|
String getString(String name);
|
||||||
ReadableArray getArray(String name);
|
ReadableArray getArray(String name);
|
||||||
ReadableMap getMap(String name);
|
ReadableMap getMap(String name);
|
||||||
|
|||||||
@@ -44,4 +44,10 @@ public class ReadableNativeArray extends NativeArray implements ReadableArray {
|
|||||||
public int getInt(int index) {
|
public int getInt(int index) {
|
||||||
return (int) getDouble(index);
|
return (int) getDouble(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check CatalystStylesDiffMap#getColorInt() to see why this is needed
|
||||||
|
@Override
|
||||||
|
public int getColorInt(int index) {
|
||||||
|
return (int) (long) getDouble(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ public class ReadableNativeMap extends NativeMap implements ReadableMap {
|
|||||||
return (int) getDouble(name);
|
return (int) getDouble(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check CatalystStylesDiffMap#getColorInt() to see why this is needed
|
||||||
|
@Override
|
||||||
|
public int getColorInt(String name) {
|
||||||
|
return (int) (long) getDouble(name);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Implementation of a {@link ReadableNativeMap} iterator in native memory.
|
* Implementation of a {@link ReadableNativeMap} iterator in native memory.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import com.facebook.react.bridge.ReadableMap;
|
|||||||
*/
|
*/
|
||||||
public class BaseViewPropertyApplicator {
|
public class BaseViewPropertyApplicator {
|
||||||
|
|
||||||
private static final String PROP_BACKGROUND_COLOR = ViewProps.BACKGROUND_COLOR;
|
|
||||||
private static final String PROP_DECOMPOSED_MATRIX = "decomposedMatrix";
|
private static final String PROP_DECOMPOSED_MATRIX = "decomposedMatrix";
|
||||||
private static final String PROP_DECOMPOSED_MATRIX_ROTATE = "rotate";
|
private static final String PROP_DECOMPOSED_MATRIX_ROTATE = "rotate";
|
||||||
private static final String PROP_DECOMPOSED_MATRIX_SCALE_X = "scaleX";
|
private static final String PROP_DECOMPOSED_MATRIX_SCALE_X = "scaleX";
|
||||||
@@ -55,7 +54,7 @@ public class BaseViewPropertyApplicator {
|
|||||||
props.put(PROP_ACCESSIBILITY_LABEL, UIProp.Type.STRING);
|
props.put(PROP_ACCESSIBILITY_LABEL, UIProp.Type.STRING);
|
||||||
props.put(PROP_ACCESSIBILITY_COMPONENT_TYPE, UIProp.Type.STRING);
|
props.put(PROP_ACCESSIBILITY_COMPONENT_TYPE, UIProp.Type.STRING);
|
||||||
props.put(PROP_ACCESSIBILITY_LIVE_REGION, UIProp.Type.STRING);
|
props.put(PROP_ACCESSIBILITY_LIVE_REGION, UIProp.Type.STRING);
|
||||||
props.put(PROP_BACKGROUND_COLOR, UIProp.Type.STRING);
|
props.put(ViewProps.BACKGROUND_COLOR, UIProp.Type.STRING);
|
||||||
props.put(PROP_IMPORTANT_FOR_ACCESSIBILITY, UIProp.Type.STRING);
|
props.put(PROP_IMPORTANT_FOR_ACCESSIBILITY, UIProp.Type.STRING);
|
||||||
props.put(PROP_OPACITY, UIProp.Type.NUMBER);
|
props.put(PROP_OPACITY, UIProp.Type.NUMBER);
|
||||||
props.put(PROP_ROTATION, UIProp.Type.NUMBER);
|
props.put(PROP_ROTATION, UIProp.Type.NUMBER);
|
||||||
@@ -73,13 +72,9 @@ public class BaseViewPropertyApplicator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void applyCommonViewProperties(View view, CatalystStylesDiffMap props) {
|
public static void applyCommonViewProperties(View view, CatalystStylesDiffMap props) {
|
||||||
if (props.hasKey(PROP_BACKGROUND_COLOR)) {
|
if (props.hasKey(ViewProps.BACKGROUND_COLOR)) {
|
||||||
String backgroundString = props.getString(PROP_BACKGROUND_COLOR);
|
final int backgroundColor = props.getColorInt(ViewProps.BACKGROUND_COLOR, Color.TRANSPARENT);
|
||||||
if (backgroundString == null) {
|
view.setBackgroundColor(backgroundColor);
|
||||||
view.setBackgroundColor(Color.TRANSPARENT);
|
|
||||||
} else {
|
|
||||||
view.setBackgroundColor(CSSColorUtil.getColor(backgroundString));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (props.hasKey(PROP_DECOMPOSED_MATRIX)) {
|
if (props.hasKey(PROP_DECOMPOSED_MATRIX)) {
|
||||||
ReadableMap decomposedMatrix = props.getMap(PROP_DECOMPOSED_MATRIX);
|
ReadableMap decomposedMatrix = props.getMap(PROP_DECOMPOSED_MATRIX);
|
||||||
|
|||||||
@@ -67,6 +67,17 @@ public class CatalystStylesDiffMap {
|
|||||||
return mBackingMap.isNull(name) ? restoreNullToDefaultValue : (int) mBackingMap.getDouble(name);
|
return mBackingMap.isNull(name) ? restoreNullToDefaultValue : (int) mBackingMap.getDouble(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Colors have values between 0x00000000 and 0xFFFFFFFF, which fits in an integer, but is sent as
|
||||||
|
// a double over the bridge. Because color values can be higher than Integer.MAX_VALUE, it is not
|
||||||
|
// correct to convert doubles to int directly, since they can be truncated to Integer.MAX_VALUE
|
||||||
|
// instead of being converted to negative values. Converting from double to long maintains the
|
||||||
|
// initial value, and is then correctly converted to int. This is the expected behavior according
|
||||||
|
// to the java spec, see http://stackoverflow.com/questions/10641559 for more.
|
||||||
|
public int getColorInt(String name, int restoreNullToDefaultValue) {
|
||||||
|
return mBackingMap.isNull(name) ? restoreNullToDefaultValue :
|
||||||
|
(int) (long) mBackingMap.getDouble(name);
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getString(String name) {
|
public String getString(String name) {
|
||||||
return mBackingMap.getString(name);
|
return mBackingMap.getString(name);
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ public @interface UIProp {
|
|||||||
NUMBER("number"),
|
NUMBER("number"),
|
||||||
STRING("String"),
|
STRING("String"),
|
||||||
MAP("Map"),
|
MAP("Map"),
|
||||||
ARRAY("Array");
|
ARRAY("Array"),
|
||||||
|
COLOR("Color");
|
||||||
|
|
||||||
private final String mType;
|
private final String mType;
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,10 @@ package com.facebook.react.views.image;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
|
||||||
import com.facebook.drawee.backends.pipeline.Fresco;
|
import com.facebook.drawee.backends.pipeline.Fresco;
|
||||||
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
|
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
|
||||||
import com.facebook.react.uimanager.CSSColorUtil;
|
|
||||||
import com.facebook.react.uimanager.CatalystStylesDiffMap;
|
import com.facebook.react.uimanager.CatalystStylesDiffMap;
|
||||||
import com.facebook.react.uimanager.SimpleViewManager;
|
import com.facebook.react.uimanager.SimpleViewManager;
|
||||||
import com.facebook.react.uimanager.ThemedReactContext;
|
import com.facebook.react.uimanager.ThemedReactContext;
|
||||||
@@ -76,11 +77,11 @@ public class ReactImageManager extends SimpleViewManager<ReactImageView> {
|
|||||||
view.setBorderRadius(props.getFloat(PROP_BORDER_RADIUS, 0.0f));
|
view.setBorderRadius(props.getFloat(PROP_BORDER_RADIUS, 0.0f));
|
||||||
}
|
}
|
||||||
if (props.hasKey(PROP_TINT_COLOR)) {
|
if (props.hasKey(PROP_TINT_COLOR)) {
|
||||||
String tintColorString = props.getString(PROP_TINT_COLOR);
|
if (props.isNull(PROP_TINT_COLOR)) {
|
||||||
if (tintColorString == null) {
|
|
||||||
view.clearColorFilter();
|
view.clearColorFilter();
|
||||||
} else {
|
} else {
|
||||||
view.setColorFilter(CSSColorUtil.getColor(tintColorString));
|
final int tintColor = props.getColorInt(PROP_TINT_COLOR, Color.TRANSPARENT);
|
||||||
|
view.setColorFilter(tintColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
view.maybeUpdateView();
|
view.maybeUpdateView();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import javax.annotation.Nullable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.text.BoringLayout;
|
import android.text.BoringLayout;
|
||||||
import android.text.Layout;
|
import android.text.Layout;
|
||||||
@@ -31,7 +32,6 @@ import com.facebook.csslayout.CSSConstants;
|
|||||||
import com.facebook.csslayout.CSSNode;
|
import com.facebook.csslayout.CSSNode;
|
||||||
import com.facebook.csslayout.MeasureOutput;
|
import com.facebook.csslayout.MeasureOutput;
|
||||||
import com.facebook.infer.annotation.Assertions;
|
import com.facebook.infer.annotation.Assertions;
|
||||||
import com.facebook.react.uimanager.CSSColorUtil;
|
|
||||||
import com.facebook.react.uimanager.CatalystStylesDiffMap;
|
import com.facebook.react.uimanager.CatalystStylesDiffMap;
|
||||||
import com.facebook.react.uimanager.IllegalViewOperationException;
|
import com.facebook.react.uimanager.IllegalViewOperationException;
|
||||||
import com.facebook.react.uimanager.PixelUtil;
|
import com.facebook.react.uimanager.PixelUtil;
|
||||||
@@ -307,21 +307,19 @@ public class ReactTextShadowNode extends ReactShadowNode {
|
|||||||
markUpdated();
|
markUpdated();
|
||||||
}
|
}
|
||||||
if (styles.hasKey(ViewProps.COLOR)) {
|
if (styles.hasKey(ViewProps.COLOR)) {
|
||||||
String colorString = styles.getString(ViewProps.COLOR);
|
if (styles.isNull(ViewProps.COLOR)) {
|
||||||
if (colorString == null) {
|
|
||||||
mIsColorSet = false;
|
mIsColorSet = false;
|
||||||
} else {
|
} else {
|
||||||
mColor = CSSColorUtil.getColor(colorString);
|
mColor = styles.getColorInt(ViewProps.COLOR, Color.TRANSPARENT);
|
||||||
mIsColorSet = true;
|
mIsColorSet = true;
|
||||||
}
|
}
|
||||||
markUpdated();
|
markUpdated();
|
||||||
}
|
}
|
||||||
if (styles.hasKey(ViewProps.BACKGROUND_COLOR)) {
|
if (styles.hasKey(ViewProps.BACKGROUND_COLOR)) {
|
||||||
String colorString = styles.getString(ViewProps.BACKGROUND_COLOR);
|
if (styles.isNull(ViewProps.BACKGROUND_COLOR)) {
|
||||||
if (colorString == null) {
|
|
||||||
mIsBackgroundColorSet = false;
|
mIsBackgroundColorSet = false;
|
||||||
} else {
|
} else {
|
||||||
mBackgroundColor = CSSColorUtil.getColor(colorString);
|
mBackgroundColor = styles.getColorInt(ViewProps.BACKGROUND_COLOR, Color.TRANSPARENT);
|
||||||
mIsBackgroundColorSet = true;
|
mIsBackgroundColorSet = true;
|
||||||
}
|
}
|
||||||
markUpdated();
|
markUpdated();
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import javax.annotation.Nullable;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
@@ -31,7 +32,6 @@ import com.facebook.react.bridge.ReactContext;
|
|||||||
import com.facebook.react.bridge.ReadableArray;
|
import com.facebook.react.bridge.ReadableArray;
|
||||||
import com.facebook.react.common.MapBuilder;
|
import com.facebook.react.common.MapBuilder;
|
||||||
import com.facebook.react.uimanager.BaseViewPropertyApplicator;
|
import com.facebook.react.uimanager.BaseViewPropertyApplicator;
|
||||||
import com.facebook.react.uimanager.CSSColorUtil;
|
|
||||||
import com.facebook.react.uimanager.CatalystStylesDiffMap;
|
import com.facebook.react.uimanager.CatalystStylesDiffMap;
|
||||||
import com.facebook.react.uimanager.PixelUtil;
|
import com.facebook.react.uimanager.PixelUtil;
|
||||||
import com.facebook.react.uimanager.ThemedReactContext;
|
import com.facebook.react.uimanager.ThemedReactContext;
|
||||||
@@ -53,6 +53,10 @@ public class ReactTextInputManager extends ViewManager<ReactEditText, ReactTextI
|
|||||||
private static final int FOCUS_TEXT_INPUT = 1;
|
private static final int FOCUS_TEXT_INPUT = 1;
|
||||||
private static final int BLUR_TEXT_INPUT = 2;
|
private static final int BLUR_TEXT_INPUT = 2;
|
||||||
|
|
||||||
|
@UIProp(UIProp.Type.STRING)
|
||||||
|
public static final String PROP_TEXT_INPUT_TEXT = "text";
|
||||||
|
@UIProp(UIProp.Type.NUMBER)
|
||||||
|
public static final String PROP_TEXT_INPUT_MOST_RECENT_EVENT_COUNT = "mostRecentEventCount";
|
||||||
@UIProp(UIProp.Type.NUMBER)
|
@UIProp(UIProp.Type.NUMBER)
|
||||||
public static final String PROP_FONT_SIZE = ViewProps.FONT_SIZE;
|
public static final String PROP_FONT_SIZE = ViewProps.FONT_SIZE;
|
||||||
@UIProp(UIProp.Type.BOOLEAN)
|
@UIProp(UIProp.Type.BOOLEAN)
|
||||||
@@ -65,7 +69,7 @@ public class ReactTextInputManager extends ViewManager<ReactEditText, ReactTextI
|
|||||||
public static final String PROP_TEXT_ALIGN_VERTICAL = "textAlignVertical";
|
public static final String PROP_TEXT_ALIGN_VERTICAL = "textAlignVertical";
|
||||||
@UIProp(UIProp.Type.STRING)
|
@UIProp(UIProp.Type.STRING)
|
||||||
public static final String PROP_TEXT_INPUT_HINT = "placeholder";
|
public static final String PROP_TEXT_INPUT_HINT = "placeholder";
|
||||||
@UIProp(UIProp.Type.STRING)
|
@UIProp(UIProp.Type.COLOR)
|
||||||
public static final String PROP_TEXT_INPUT_HINT_COLOR = "placeholderTextColor";
|
public static final String PROP_TEXT_INPUT_HINT_COLOR = "placeholderTextColor";
|
||||||
@UIProp(UIProp.Type.NUMBER)
|
@UIProp(UIProp.Type.NUMBER)
|
||||||
public static final String PROP_TEXT_INPUT_NUMLINES = ViewProps.NUMBER_OF_LINES;
|
public static final String PROP_TEXT_INPUT_NUMLINES = ViewProps.NUMBER_OF_LINES;
|
||||||
@@ -77,8 +81,10 @@ public class ReactTextInputManager extends ViewManager<ReactEditText, ReactTextI
|
|||||||
public static final String PROP_TEXT_INPUT_PASSWORD = "password";
|
public static final String PROP_TEXT_INPUT_PASSWORD = "password";
|
||||||
@UIProp(UIProp.Type.BOOLEAN)
|
@UIProp(UIProp.Type.BOOLEAN)
|
||||||
public static final String PROP_TEXT_INPUT_EDITABLE = "editable";
|
public static final String PROP_TEXT_INPUT_EDITABLE = "editable";
|
||||||
@UIProp(UIProp.Type.STRING)
|
@UIProp(UIProp.Type.COLOR)
|
||||||
public static final String PROP_TEXT_INPUT_UNDERLINE_COLOR = "underlineColorAndroid";
|
public static final String PROP_TEXT_INPUT_UNDERLINE_COLOR = "underlineColorAndroid";
|
||||||
|
@UIProp(UIProp.Type.NUMBER)
|
||||||
|
public static final String PROP_TEST_ID = "testID";
|
||||||
|
|
||||||
private static final String KEYBOARD_TYPE_EMAIL_ADDRESS = "email-address";
|
private static final String KEYBOARD_TYPE_EMAIL_ADDRESS = "email-address";
|
||||||
private static final String KEYBOARD_TYPE_NUMERIC = "numeric";
|
private static final String KEYBOARD_TYPE_NUMERIC = "numeric";
|
||||||
@@ -93,6 +99,7 @@ public class ReactTextInputManager extends ViewManager<ReactEditText, ReactTextI
|
|||||||
ReactEditText editText = new ReactEditText(context);
|
ReactEditText editText = new ReactEditText(context);
|
||||||
int inputType = editText.getInputType();
|
int inputType = editText.getInputType();
|
||||||
editText.setInputType(inputType & (~InputType.TYPE_TEXT_FLAG_MULTI_LINE));
|
editText.setInputType(inputType & (~InputType.TYPE_TEXT_FLAG_MULTI_LINE));
|
||||||
|
editText.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||||
editText.setTextSize(
|
editText.setTextSize(
|
||||||
TypedValue.COMPLEX_UNIT_PX,
|
TypedValue.COMPLEX_UNIT_PX,
|
||||||
(int) Math.ceil(PixelUtil.toPixelFromSP(ViewDefaults.FONT_SIZE_SP)));
|
(int) Math.ceil(PixelUtil.toPixelFromSP(ViewDefaults.FONT_SIZE_SP)));
|
||||||
@@ -185,12 +192,11 @@ public class ReactTextInputManager extends ViewManager<ReactEditText, ReactTextI
|
|||||||
|
|
||||||
//Prevents flickering color while waiting for JS update.
|
//Prevents flickering color while waiting for JS update.
|
||||||
if (props.hasKey(ViewProps.COLOR)) {
|
if (props.hasKey(ViewProps.COLOR)) {
|
||||||
final String colorStr = props.getString(ViewProps.COLOR);
|
if (props.isNull(ViewProps.COLOR)) {
|
||||||
if (colorStr != null) {
|
|
||||||
final int color = CSSColorUtil.getColor(colorStr);
|
|
||||||
view.setTextColor(color);
|
|
||||||
} else {
|
|
||||||
view.setTextColor(DefaultStyleValuesUtil.getDefaultTextColor(view.getContext()));
|
view.setTextColor(DefaultStyleValuesUtil.getDefaultTextColor(view.getContext()));
|
||||||
|
} else {
|
||||||
|
final int textColor = props.getColorInt(ViewProps.COLOR, Color.TRANSPARENT);
|
||||||
|
view.setTextColor(textColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,25 +205,21 @@ public class ReactTextInputManager extends ViewManager<ReactEditText, ReactTextI
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (props.hasKey(PROP_TEXT_INPUT_HINT_COLOR)) {
|
if (props.hasKey(PROP_TEXT_INPUT_HINT_COLOR)) {
|
||||||
final String colorStr = props.getString(PROP_TEXT_INPUT_HINT_COLOR);
|
if (props.isNull(PROP_TEXT_INPUT_HINT_COLOR)) {
|
||||||
if (colorStr != null) {
|
|
||||||
final int color = CSSColorUtil.getColor(colorStr);
|
|
||||||
view.setHintTextColor(color);
|
|
||||||
} else {
|
|
||||||
view.setHintTextColor(DefaultStyleValuesUtil.getDefaultTextColorHint(view.getContext()));
|
view.setHintTextColor(DefaultStyleValuesUtil.getDefaultTextColorHint(view.getContext()));
|
||||||
// We need to invalidate in order to force EditText to update hint color.
|
} else {
|
||||||
// see updateTextColors() method in TextView.java
|
final int hintColor = props.getColorInt(PROP_TEXT_INPUT_HINT_COLOR, Color.TRANSPARENT);
|
||||||
view.invalidate();
|
view.setHintTextColor(hintColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.hasKey(PROP_TEXT_INPUT_UNDERLINE_COLOR)) {
|
if (props.hasKey(PROP_TEXT_INPUT_UNDERLINE_COLOR)) {
|
||||||
String colorStr = props.getString(PROP_TEXT_INPUT_UNDERLINE_COLOR);
|
if (props.isNull(PROP_TEXT_INPUT_UNDERLINE_COLOR)) {
|
||||||
if (colorStr != null) {
|
|
||||||
int color = CSSColorUtil.getColor(colorStr);
|
|
||||||
view.getBackground().setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
|
||||||
} else {
|
|
||||||
view.getBackground().clearColorFilter();
|
view.getBackground().clearColorFilter();
|
||||||
|
} else {
|
||||||
|
final int underlineColor =
|
||||||
|
props.getColorInt(PROP_TEXT_INPUT_UNDERLINE_COLOR, Color.TRANSPARENT);
|
||||||
|
view.getBackground().setColorFilter(underlineColor, PorterDuff.Mode.SRC_IN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import com.facebook.react.views.text.ReactTextShadowNode;
|
|||||||
/* package */ class ReactTextInputShadowNode extends ReactTextShadowNode implements
|
/* package */ class ReactTextInputShadowNode extends ReactTextShadowNode implements
|
||||||
CSSNode.MeasureFunction {
|
CSSNode.MeasureFunction {
|
||||||
|
|
||||||
public static final String PROP_TEXT_INPUT_MOST_RECENT_EVENT_COUNT = "mostRecentEventCount";
|
|
||||||
private static final int MEASURE_SPEC = View.MeasureSpec.makeMeasureSpec(
|
private static final int MEASURE_SPEC = View.MeasureSpec.makeMeasureSpec(
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||||
View.MeasureSpec.UNSPECIFIED);
|
View.MeasureSpec.UNSPECIFIED);
|
||||||
@@ -105,8 +104,9 @@ import com.facebook.react.views.text.ReactTextShadowNode;
|
|||||||
mFontSize = (int) Math.ceil(PixelUtil.toPixelFromSP(fontSize));
|
mFontSize = (int) Math.ceil(PixelUtil.toPixelFromSP(fontSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (styles.hasKey(PROP_TEXT_INPUT_MOST_RECENT_EVENT_COUNT)) {
|
if (styles.hasKey(ReactTextInputManager.PROP_TEXT_INPUT_MOST_RECENT_EVENT_COUNT)) {
|
||||||
mJsEventCount = styles.getInt(PROP_TEXT_INPUT_MOST_RECENT_EVENT_COUNT, 0);
|
mJsEventCount =
|
||||||
|
styles.getInt(ReactTextInputManager.PROP_TEXT_INPUT_MOST_RECENT_EVENT_COUNT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (styles.hasKey(ReactTextInputManager.PROP_TEXT_INPUT_NUMLINES)) {
|
if (styles.hasKey(ReactTextInputManager.PROP_TEXT_INPUT_NUMLINES)) {
|
||||||
|
|||||||
@@ -24,16 +24,13 @@ import android.view.View;
|
|||||||
import com.facebook.react.R;
|
import com.facebook.react.R;
|
||||||
import com.facebook.react.bridge.ReadableArray;
|
import com.facebook.react.bridge.ReadableArray;
|
||||||
import com.facebook.react.bridge.ReadableMap;
|
import com.facebook.react.bridge.ReadableMap;
|
||||||
import com.facebook.react.bridge.WritableMap;
|
|
||||||
import com.facebook.react.bridge.WritableNativeMap;
|
|
||||||
import com.facebook.react.uimanager.CSSColorUtil;
|
|
||||||
import com.facebook.react.uimanager.CatalystStylesDiffMap;
|
import com.facebook.react.uimanager.CatalystStylesDiffMap;
|
||||||
import com.facebook.react.uimanager.ThemedReactContext;
|
import com.facebook.react.uimanager.ThemedReactContext;
|
||||||
import com.facebook.react.uimanager.UIManagerModule;
|
import com.facebook.react.uimanager.UIManagerModule;
|
||||||
import com.facebook.react.uimanager.UIProp;
|
import com.facebook.react.uimanager.UIProp;
|
||||||
|
import com.facebook.react.uimanager.ViewGroupManager;
|
||||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||||
import com.facebook.react.views.toolbar.events.ToolbarClickEvent;
|
import com.facebook.react.views.toolbar.events.ToolbarClickEvent;
|
||||||
import com.facebook.react.uimanager.ViewGroupManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages instances of Toolbar.
|
* Manages instances of Toolbar.
|
||||||
@@ -48,11 +45,11 @@ public class ReactToolbarManager extends ViewGroupManager<Toolbar> {
|
|||||||
public static final String PROP_NAV_ICON = "navIcon";
|
public static final String PROP_NAV_ICON = "navIcon";
|
||||||
@UIProp(UIProp.Type.STRING)
|
@UIProp(UIProp.Type.STRING)
|
||||||
public static final String PROP_SUBTITLE = "subtitle";
|
public static final String PROP_SUBTITLE = "subtitle";
|
||||||
@UIProp(UIProp.Type.STRING)
|
@UIProp(UIProp.Type.COLOR)
|
||||||
public static final String PROP_SUBTITLE_COLOR = "subtitleColor";
|
public static final String PROP_SUBTITLE_COLOR = "subtitleColor";
|
||||||
@UIProp(UIProp.Type.STRING)
|
@UIProp(UIProp.Type.STRING)
|
||||||
public static final String PROP_TITLE = "title";
|
public static final String PROP_TITLE = "title";
|
||||||
@UIProp(UIProp.Type.STRING)
|
@UIProp(UIProp.Type.COLOR)
|
||||||
public static final String PROP_TITLE_COLOR = "titleColor";
|
public static final String PROP_TITLE_COLOR = "titleColor";
|
||||||
@UIProp(UIProp.Type.ARRAY)
|
@UIProp(UIProp.Type.ARRAY)
|
||||||
public static final String PROP_ACTIONS = "actions";
|
public static final String PROP_ACTIONS = "actions";
|
||||||
@@ -81,23 +78,15 @@ public class ReactToolbarManager extends ViewGroupManager<Toolbar> {
|
|||||||
toolbar.setSubtitle(props.getString(PROP_SUBTITLE));
|
toolbar.setSubtitle(props.getString(PROP_SUBTITLE));
|
||||||
}
|
}
|
||||||
if (props.hasKey(PROP_SUBTITLE_COLOR)) {
|
if (props.hasKey(PROP_SUBTITLE_COLOR)) {
|
||||||
String color = props.getString(PROP_SUBTITLE_COLOR);
|
final int subtitleColor = props.getColorInt(PROP_SUBTITLE_COLOR, defaultColors[1]);
|
||||||
if (color != null) {
|
toolbar.setSubtitleTextColor(subtitleColor);
|
||||||
toolbar.setSubtitleTextColor(CSSColorUtil.getColor(color));
|
|
||||||
} else {
|
|
||||||
toolbar.setSubtitleTextColor(defaultColors[1]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (props.hasKey(PROP_TITLE)) {
|
if (props.hasKey(PROP_TITLE)) {
|
||||||
toolbar.setTitle(props.getString(PROP_TITLE));
|
toolbar.setTitle(props.getString(PROP_TITLE));
|
||||||
}
|
}
|
||||||
if (props.hasKey(PROP_TITLE_COLOR)) {
|
if (props.hasKey(PROP_TITLE_COLOR)) {
|
||||||
String color = props.getString(PROP_TITLE_COLOR);
|
final int titleColor = props.getColorInt(PROP_TITLE_COLOR, defaultColors[0]);
|
||||||
if (color != null) {
|
toolbar.setTitleTextColor(titleColor);
|
||||||
toolbar.setTitleTextColor(CSSColorUtil.getColor(color));
|
|
||||||
} else {
|
|
||||||
toolbar.setTitleTextColor(defaultColors[0]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (props.hasKey(PROP_NAV_ICON)) {
|
if (props.hasKey(PROP_NAV_ICON)) {
|
||||||
String navIcon = props.getString(PROP_NAV_ICON);
|
String navIcon = props.getString(PROP_NAV_ICON);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import android.util.TypedValue;
|
|||||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||||
import com.facebook.react.bridge.ReadableMap;
|
import com.facebook.react.bridge.ReadableMap;
|
||||||
import com.facebook.react.bridge.SoftAssertions;
|
import com.facebook.react.bridge.SoftAssertions;
|
||||||
import com.facebook.react.uimanager.CSSColorUtil;
|
import com.facebook.react.uimanager.ViewProps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class that helps with converting android drawable description used in JS to an actual
|
* Utility class that helps with converting android drawable description used in JS to an actual
|
||||||
@@ -60,11 +60,10 @@ import com.facebook.react.uimanager.CSSColorUtil;
|
|||||||
throw new JSApplicationIllegalArgumentException("Ripple drawable is not available on " +
|
throw new JSApplicationIllegalArgumentException("Ripple drawable is not available on " +
|
||||||
"android API <21");
|
"android API <21");
|
||||||
}
|
}
|
||||||
String colorName = drawableDescriptionDict.hasKey("color") ?
|
|
||||||
drawableDescriptionDict.getString("color") : null;
|
|
||||||
int color;
|
int color;
|
||||||
if (colorName != null) {
|
if (drawableDescriptionDict.hasKey(ViewProps.COLOR) &&
|
||||||
color = CSSColorUtil.getColor(colorName);
|
!drawableDescriptionDict.isNull(ViewProps.COLOR)) {
|
||||||
|
color = drawableDescriptionDict.getColorInt(ViewProps.COLOR);
|
||||||
} else {
|
} else {
|
||||||
if (context.getTheme().resolveAttribute(
|
if (context.getTheme().resolveAttribute(
|
||||||
android.R.attr.colorControlHighlight,
|
android.R.attr.colorControlHighlight,
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ import com.facebook.csslayout.Spacing;
|
|||||||
*/
|
*/
|
||||||
private int getFullBorderColor() {
|
private int getFullBorderColor() {
|
||||||
return (mBorderColor != null && !CSSConstants.isUndefined(mBorderColor.getRaw(Spacing.ALL))) ?
|
return (mBorderColor != null && !CSSConstants.isUndefined(mBorderColor.getRaw(Spacing.ALL))) ?
|
||||||
(int) mBorderColor.getRaw(Spacing.ALL) : DEFAULT_BORDER_COLOR;
|
(int) (long) mBorderColor.getRaw(Spacing.ALL) : DEFAULT_BORDER_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawRectangularBackgroundWithBorders(Canvas canvas) {
|
private void drawRectangularBackgroundWithBorders(Canvas canvas) {
|
||||||
@@ -296,6 +296,7 @@ import com.facebook.csslayout.Spacing;
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getBorderColor(int position) {
|
private int getBorderColor(int position) {
|
||||||
return mBorderColor != null ? (int) mBorderColor.get(position) : DEFAULT_BORDER_COLOR;
|
// Check CatalystStylesDiffMap#getColorInt() to see why this is needed
|
||||||
|
return mBorderColor != null ? (int) (long) mBorderColor.get(position) : DEFAULT_BORDER_COLOR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import javax.annotation.Nullable;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
@@ -23,8 +24,8 @@ import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
|||||||
import com.facebook.react.bridge.ReadableArray;
|
import com.facebook.react.bridge.ReadableArray;
|
||||||
import com.facebook.react.bridge.ReadableMap;
|
import com.facebook.react.bridge.ReadableMap;
|
||||||
import com.facebook.react.common.MapBuilder;
|
import com.facebook.react.common.MapBuilder;
|
||||||
|
import com.facebook.react.common.annotations.VisibleForTesting;
|
||||||
import com.facebook.react.uimanager.BaseViewPropertyApplicator;
|
import com.facebook.react.uimanager.BaseViewPropertyApplicator;
|
||||||
import com.facebook.react.uimanager.CSSColorUtil;
|
|
||||||
import com.facebook.react.uimanager.CatalystStylesDiffMap;
|
import com.facebook.react.uimanager.CatalystStylesDiffMap;
|
||||||
import com.facebook.react.uimanager.PixelUtil;
|
import com.facebook.react.uimanager.PixelUtil;
|
||||||
import com.facebook.react.uimanager.PointerEvents;
|
import com.facebook.react.uimanager.PointerEvents;
|
||||||
@@ -32,7 +33,6 @@ import com.facebook.react.uimanager.ThemedReactContext;
|
|||||||
import com.facebook.react.uimanager.UIProp;
|
import com.facebook.react.uimanager.UIProp;
|
||||||
import com.facebook.react.uimanager.ViewGroupManager;
|
import com.facebook.react.uimanager.ViewGroupManager;
|
||||||
import com.facebook.react.uimanager.ViewProps;
|
import com.facebook.react.uimanager.ViewProps;
|
||||||
import com.facebook.react.common.annotations.VisibleForTesting;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View manager for AndroidViews (plain React Views).
|
* View manager for AndroidViews (plain React Views).
|
||||||
@@ -103,9 +103,13 @@ public class ReactViewManager extends ViewGroupManager<ReactViewGroup> {
|
|||||||
for (int i = 0; i < SPACING_TYPES.length; i++) {
|
for (int i = 0; i < SPACING_TYPES.length; i++) {
|
||||||
String key = PROPS_BORDER_COLOR[i];
|
String key = PROPS_BORDER_COLOR[i];
|
||||||
if (props.hasKey(key)) {
|
if (props.hasKey(key)) {
|
||||||
String color = props.getString(key);
|
float color = CSSConstants.UNDEFINED;
|
||||||
float colorFloat = color == null ? CSSConstants.UNDEFINED : CSSColorUtil.getColor(color);
|
if (!props.isNull(PROPS_BORDER_COLOR[i])) {
|
||||||
view.setBorderColor(SPACING_TYPES[i], colorFloat);
|
// Check CatalystStylesDiffMap#getColorInt() to see why this is needed
|
||||||
|
int colorInt = props.getColorInt(PROPS_BORDER_COLOR[i], Color.TRANSPARENT);
|
||||||
|
color = colorInt;
|
||||||
|
}
|
||||||
|
view.setBorderColor(SPACING_TYPES[i], color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ buildscript {
|
|||||||
mavenLocal()
|
mavenLocal()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.2.3'
|
classpath 'com.android.tools.build:gradle:1.3.1'
|
||||||
classpath 'de.undercouch:gradle-download-task:1.2'
|
classpath 'de.undercouch:gradle-download-task:1.2'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
|||||||
Reference in New Issue
Block a user