BREAKING [react_native] Move to new C-based implementation of css-layout in RN Android

Summary:
Moves from CSSNodeDEPRECATED to CSSNode. This has shown to be a huge performance win for layout time within FB.

This is BREAKING because CSSNode contains bug fixes that were not migrated to CSSNodeDEPRECATED which may change the way your layout appears. The most common of these by far involves `flex: 1`.

Previously, developers had to put `flex: 1` in many places it didn't belong in order to work around a bug in css-layout. Now `flex: 1` is treated properly and, unfortunately, this means that your layout may no longer look correct. Specifically, you may see that your layout looks collapsed, or children don't render. The fix is to simply remove `flex: 1` from those containers.

Reviewed By: emilsjolander

Differential Revision: D3992787

fbshipit-source-id: 7a3a2a34a8941c0524e6ba3c5379e434d3e03247
This commit is contained in:
Andy Street
2016-11-21 06:16:27 -08:00
committed by Facebook Github Bot
parent 27817bed0e
commit d63ba47b59
16 changed files with 124 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
include_defs('//ReactAndroid/DEFS')
robolectric3_test(
rn_robolectric_test(
name = 'react',
# Please change the contact to the oncall of your team
contacts = ['oncall+fbandroid_sheriff@xmail.facebook.com'],

View File

@@ -1,6 +1,6 @@
include_defs('//ReactAndroid/DEFS')
robolectric3_test(
rn_robolectric_test(
name = 'animated',
# Please change the contact to the oncall of your team
contacts = ['oncall+fbandroid_sheriff@xmail.facebook.com'],

View File

@@ -19,7 +19,7 @@ android_library(
],
)
robolectric3_test(
rn_robolectric_test(
name = 'bridge',
# Please change the contact to the oncall of your team
contacts = ['oncall+fbandroid_sheriff@xmail.facebook.com'],

View File

@@ -1,6 +1,6 @@
include_defs('//ReactAndroid/DEFS')
robolectric3_test(
rn_robolectric_test(
name = 'devsupport',
# Please change the contact to the oncall of your team
contacts = ['oncall+fbandroid_sheriff@xmail.facebook.com'],

View File

@@ -1,6 +1,6 @@
include_defs('//ReactAndroid/DEFS')
robolectric3_test(
rn_robolectric_test(
# Please change the contact to the oncall of your team
contacts = ['oncall+fbandroid_sheriff@xmail.facebook.com'],
name = 'modules',

View File

@@ -1,6 +1,6 @@
include_defs('//ReactAndroid/DEFS')
robolectric3_test(
rn_robolectric_test(
name = 'uimanager',
# Please change the contact to the oncall of your team
contacts = ['oncall+fbandroid_sheriff@xmail.facebook.com'],

View File

@@ -11,6 +11,9 @@ package com.facebook.react.uimanager;
import javax.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.JavaOnlyMap;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.annotations.ReactPropGroup;
@@ -22,8 +25,6 @@ import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.rule.PowerMockRule;
import org.robolectric.RobolectricTestRunner;
import static com.facebook.react.uimanager.ReactPropAnnotationSetterTest.ViewManagerUpdatesReceiver;
import static com.facebook.react.uimanager.ReactPropAnnotationSetterTest.buildStyles;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
@@ -41,6 +42,25 @@ public class ReactPropForShadowNodeSetterTest {
@Rule
public PowerMockRule rule = new PowerMockRule();
public interface ViewManagerUpdatesReceiver {
void onBooleanSetterCalled(boolean value);
void onIntSetterCalled(int value);
void onDoubleSetterCalled(double value);
void onFloatSetterCalled(float value);
void onStringSetterCalled(String value);
void onBoxedBooleanSetterCalled(Boolean value);
void onBoxedIntSetterCalled(Integer value);
void onArraySetterCalled(ReadableArray value);
void onMapSetterCalled(ReadableMap value);
void onFloatGroupPropSetterCalled(int index, float value);
void onIntGroupPropSetterCalled(int index, int value);
void onBoxedIntGroupPropSetterCalled(int index, Integer value);
}
public static ReactStylesDiffMap buildStyles(Object... keysAndValues) {
return new ReactStylesDiffMap(JavaOnlyMap.of(keysAndValues));
}
private class ShadowViewUnderTest extends ReactShadowNode {
private ViewManagerUpdatesReceiver mViewManagerUpdatesReceiver;
@@ -65,8 +85,8 @@ public class ReactPropForShadowNodeSetterTest {
}
@ReactPropGroup(names = {
"floatGroupPropFirst",
"floatGroupPropSecond",
"floatGroupPropFirst",
"floatGroupPropSecond",
})
public void setFloatGroupProp(int index, float value) {
mViewManagerUpdatesReceiver.onFloatGroupPropSetterCalled(index, value);

View File

@@ -1,6 +1,6 @@
include_defs('//ReactAndroid/DEFS')
robolectric3_test(
rn_robolectric_test(
name = 'views',
# Please change the contact to the oncall of your team
contacts = ['oncall+fbandroid_sheriff@xmail.facebook.com'],