Fix key mismatch in text layout

Summary:
Changelog: [Internal]

There was a key mismatch between what Java and C++.
cacheIdMap was incorrectly initialised.

Differential Revision: D23652342

fbshipit-source-id: 66f54dc887a011afeead9420bda093e9a0c9a8ca
This commit is contained in:
Joshua Gross 2020-09-12 21:50:51 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 250485a94c
Коммит 44229d9149
4 изменённых файлов: 8 добавлений и 7 удалений

Просмотреть файл

@ -45,8 +45,9 @@ AndroidTextInputState::AndroidTextInputState(
"mostRecentEventCount",
previousState.mostRecentEventCount)
.getInt()),
cachedAttributedStringId(
data.getDefault("cacheId", previousState.cachedAttributedStringId)
cachedAttributedStringId(data.getDefault(
"opaqueCacheId",
previousState.cachedAttributedStringId)
.getInt()),
attributedString(previousState.attributedString),
reactTreeAttributedString(previousState.reactTreeAttributedString),

Просмотреть файл

@ -29,7 +29,7 @@ class AndroidTextInputState final {
* Stores an opaque cache ID used on the Java side to refer to a specific
* AttributedString for measurement purposes only.
*/
int cachedAttributedStringId{0};
int64_t cachedAttributedStringId{0};
/*
* All content of <TextInput> component represented as an `AttributedString`.

Просмотреть файл

@ -37,7 +37,7 @@ TextMeasurement TextLayoutManager::measure(
}
TextMeasurement TextLayoutManager::measureCachedSpannableById(
int cacheId,
int64_t cacheId,
ParagraphAttributes paragraphAttributes,
LayoutConstraints layoutConstraints) const {
const jni::global_ref<jobject> &fabricUIManager =
@ -64,7 +64,7 @@ TextMeasurement TextLayoutManager::measureCachedSpannableById(
auto maximumSize = layoutConstraints.maximumSize;
local_ref<JString> componentName = make_jstring("RCTText");
folly::dynamic cacheIdMap;
folly::dynamic cacheIdMap = folly::dynamic::object;
cacheIdMap["cacheId"] = cacheId;
local_ref<ReadableNativeMap::javaobject> attributedStringRNM =
ReadableNativeMap::newObjectCxxArgs(cacheIdMap);

Просмотреть файл

@ -42,7 +42,7 @@ class TextLayoutManager {
* opaque cache ID.
*/
TextMeasurement measureCachedSpannableById(
int cacheId,
int64_t cacheId,
ParagraphAttributes paragraphAttributes,
LayoutConstraints layoutConstraints) const;