-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING [react_native] Move to new C-based implementation of css-lay…
…out 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
- Loading branch information
Showing
16 changed files
with
124 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
# - At Facebook by running buck from the root of the fb repo | ||
# - Outside of Facebook by running buck in the root of the git repo | ||
|
||
IS_OSS_BUILD = True | ||
|
||
with allow_unsafe_import(): | ||
import os | ||
|
||
|
@@ -35,6 +37,8 @@ JSC_DEPS = [ | |
|
||
CSSLAYOUT_TARGET = '//ReactAndroid/src/main/java/com/facebook:csslayout' | ||
FBGLOGINIT_TARGET = '//ReactAndroid/src/main/jni/first-party/fbgloginit:fbgloginit' | ||
FBJNI_TARGET = '//ReactAndroid/src/main/jni/first-party/fb:jni' | ||
JNI_TARGET = '//ReactAndroid/src/main/jni/first-party/jni-hack:jni-hack' | ||
|
||
# React property preprocessor | ||
original_android_library=android_library | ||
|
@@ -76,9 +80,7 @@ def android_library( | |
*args, | ||
**kwargs) | ||
|
||
|
||
def robolectric3_test(name, deps, vm_args=None, *args, **kwargs): | ||
|
||
def rn_robolectric_test(name, srcs, vm_args = None, *args, **kwargs): | ||
vm_args = vm_args or [] | ||
|
||
# We may need to create buck-out/gen/ if we're running after buck clean. | ||
|
@@ -100,11 +102,16 @@ def robolectric3_test(name, deps, vm_args=None, *args, **kwargs): | |
'-Djava.io.tmpdir=%s' % os.path.join(os.path.abspath('.'), | ||
'buck-out/bin')) | ||
|
||
# defined in BUCK | ||
# RN tests use Powermock, which means they get their own ClassLoaders. | ||
# Because the csslayout native library (or any native library) can only be loaded into one | ||
# ClassLoader at a time, we need to run each in its own process, hence fork_mode = 'per_test'. | ||
robolectric_test( | ||
name=name, | ||
deps=deps, | ||
vm_args=vm_args + extra_vm_args, | ||
*args, | ||
**kwargs | ||
) | ||
name = name, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
astreet
Author
Contributor
|
||
use_cxx_libraries = True, | ||
cxx_library_whitelist = [ | ||
'//ReactAndroid/src/main/jni/first-party/csslayoutjni:jni', | ||
], | ||
fork_mode = 'per_test', | ||
srcs = srcs, | ||
vm_args = vm_args + extra_vm_args, | ||
*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
include_defs('//ReactAndroid/DEFS') | ||
|
||
# This target is only used in open source | ||
if IS_OSS_BUILD: | ||
cxx_library( | ||
name = 'jni', | ||
soname = 'libcsslayout.$(ext)', | ||
srcs = glob(['jni/*.cpp']), | ||
header_namespace = '', | ||
compiler_flags = [ | ||
'-fno-omit-frame-pointer', | ||
'-fexceptions', | ||
'-Wall', | ||
'-Werror', | ||
'-O3', | ||
'-std=c++11', | ||
], | ||
deps = [ | ||
'//ReactCommon/CSSLayout:CSSLayout', | ||
FBJNI_TARGET, | ||
], | ||
visibility = ['PUBLIC'], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
include_defs('//ReactAndroid/DEFS') | ||
|
||
# This target is only used in open source | ||
if IS_OSS_BUILD: | ||
cxx_library( | ||
name = 'jni', | ||
soname = 'libfb.$(ext)', | ||
srcs = glob(['*.cpp', 'jni/*.cpp', 'lyra/*.cpp']), | ||
header_namespace = '', | ||
compiler_flags = [ | ||
'-fno-omit-frame-pointer', | ||
'-fexceptions', | ||
'-Wall', | ||
'-Werror', | ||
'-std=c++11', | ||
'-DDISABLE_CPUCAP', | ||
'-DDISABLE_XPLAT', | ||
], | ||
exported_headers = subdir_glob([ | ||
('include', 'fb/**/*.h'), | ||
('include', 'jni/*.h'), | ||
]), | ||
deps = [ | ||
JNI_TARGET, | ||
], | ||
visibility = ['PUBLIC'], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cxx_library( | ||
name = 'CSSLayout', | ||
force_static = True, | ||
srcs = glob(['CSSLayout/*.c']), | ||
header_namespace = '', | ||
compiler_flags = [ | ||
'-fno-omit-frame-pointer', | ||
'-fexceptions', | ||
'-Wall', | ||
'-Werror', | ||
'-std=c99', | ||
'-O3', | ||
], | ||
exported_headers = glob(['CSSLayout/*.h']), | ||
deps = [ | ||
], | ||
visibility = ['PUBLIC'], | ||
) |
@astreet
buck test ReactAndroid/src/test/java/com/facebook/react/views
will failed with error messageFAILURE com.facebook.react.views.textinput.TextInputTest testPropsApplied: no csslayout in java.library.path
, is there any way to fix it?