mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-17 05:19:16 +08:00
Convert FabricUIManager.measure params to floats
Summary: Convert FabricUIManager.measure params to floats. Currently we convert parameters to ints across the JNI boundary, and then back to floats several times in Java. This is unnecessary and actually makes measurements trickier. The new implementation uses floats across the JNI boundary and uses Float.POSITIVE_INFINITY to represent unconstrained values, which is consistent with Fabric C++ as well. Reviewed By: shergin, mdvacca Differential Revision: D15176108 fbshipit-source-id: cf849b3773007637f059279460163872f300a4aa
This commit is contained in:
committed by
Facebook Github Bot
parent
a87af19d3f
commit
4a1d532674
@@ -36,17 +36,13 @@ Size TextLayoutManager::measure(
|
||||
jstring,
|
||||
ReadableMap::javaobject,
|
||||
ReadableMap::javaobject,
|
||||
jint,
|
||||
jint,
|
||||
jint,
|
||||
jint)>("measure");
|
||||
jfloat,
|
||||
jfloat,
|
||||
jfloat,
|
||||
jfloat)>("measure");
|
||||
|
||||
auto minimumSize = layoutConstraints.minimumSize;
|
||||
auto maximumSize = layoutConstraints.maximumSize;
|
||||
int minWidth = (int)minimumSize.width;
|
||||
int minHeight = (int)minimumSize.height;
|
||||
int maxWidth = (int)maximumSize.width;
|
||||
int maxHeight = (int)maximumSize.height;
|
||||
|
||||
local_ref<JString> componentName = make_jstring("RCTText");
|
||||
local_ref<ReadableNativeMap::javaobject> attributedStringRNM =
|
||||
@@ -63,10 +59,10 @@ Size TextLayoutManager::measure(
|
||||
componentName.get(),
|
||||
attributedStringRM.get(),
|
||||
paragraphAttributesRM.get(),
|
||||
minWidth,
|
||||
maxWidth,
|
||||
minHeight,
|
||||
maxHeight));
|
||||
minimumSize.width,
|
||||
maximumSize.width,
|
||||
minimumSize.height,
|
||||
maximumSize.height));
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
|
||||
Reference in New Issue
Block a user