mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Refactor types used during yoga meassure calls
Summary: This diff refactors the types used when Yoga requires to measure the size of a View in C++ Reviewed By: shergin Differential Revision: D13124086 fbshipit-source-id: 89dfe80bb41b4fb2eaba84af630d52ef2509b1e1
This commit is contained in:
1 parent
0357d0de64
commit
10ce6c3e11
5 files changed
+24
-14
No files matched your search
@@ -8,6 +8,7 @@
|
||||
#include "TextLayoutManager.h"
|
||||
|
||||
#include <react/attributedstring/conversions.h>
|
||||
#include <react/core/conversions.h>
|
||||
#include <react/jni/ReadableNativeMap.h>
|
||||
|
||||
using namespace facebook::jni;
|
||||
@@ -32,7 +33,7 @@ Size TextLayoutManager::measure(
|
||||
|
||||
auto clazz =
|
||||
jni::findClassStatic("com/facebook/fbreact/fabric/FabricUIManager");
|
||||
static auto measure = clazz->getMethod<JArrayFloat::javaobject(
|
||||
static auto measure = clazz->getMethod<jlong(
|
||||
jint,
|
||||
jstring,
|
||||
ReadableNativeMap::javaobject,
|
||||
@@ -49,7 +50,7 @@ Size TextLayoutManager::measure(
|
||||
int maxWidth = (int)maximumSize.width;
|
||||
int maxHeight = (int)maximumSize.height;
|
||||
local_ref<JString> componentName = make_jstring("RCTText");
|
||||
auto values = measure(
|
||||
return yogaMeassureToSize(measure(
|
||||
fabricUIManager,
|
||||
reactTag,
|
||||
componentName.get(),
|
||||
@@ -58,13 +59,7 @@ Size TextLayoutManager::measure(
|
||||
minWidth,
|
||||
maxWidth,
|
||||
minHeight,
|
||||
maxHeight);
|
||||
|
||||
std::vector<float> indices;
|
||||
indices.resize(values->size());
|
||||
values->getRegion(0, values->size(), indices.data());
|
||||
|
||||
return {indices[0], indices[1]};
|
||||
maxHeight));
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
|
||||
Reference in new issue
Block a user