Fix onPress for TextView containing just RawText

Summary: This diff enables the onPress event for TextViews that render RawText

Reviewed By: shergin

Differential Revision: D10222183

fbshipit-source-id: 4b6a6ad548286453f7dd3a14a5e4ee453a55b923
This commit is contained in:
David Vacca 2018-10-09 16:30:11 -07:00 коммит произвёл Facebook Github Bot
Родитель 74a00beeb7
Коммит 397573ffed
2 изменённых файлов: 7 добавлений и 6 удалений

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

@ -143,9 +143,7 @@ public class TextLayoutManager {
new CustomTextTransformSpan(textAttributes.mTextTransform)));
}
//TODO: add react tag as part of the fragments, react tag is used on Touch events
int reactTag = 1;
int reactTag = fragment.getInt("reactTag");
ops.add(new SetSpanOperation(start, end, new ReactTagSpan(reactTag)));
}
}

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

@ -7,14 +7,16 @@
#pragma once
#include <fabric/attributedstring/conversions.h>
#include <fabric/attributedstring/primitives.h>
#include <fabric/attributedstring/AttributedString.h>
#include <fabric/attributedstring/ParagraphAttributes.h>
#include <fabric/attributedstring/TextAttributes.h>
#include <fabric/attributedstring/conversions.h>
#include <fabric/attributedstring/primitives.h>
#include <fabric/core/conversions.h>
#include <fabric/graphics/Geometry.h>
#include <fabric/core/LayoutableShadowNode.h>
#include <fabric/core/ShadowNode.h>
#include <fabric/graphics/conversions.h>
#include <fabric/graphics/Geometry.h>
#include <folly/dynamic.h>
namespace facebook {
@ -474,6 +476,7 @@ inline folly::dynamic toDynamic(const AttributedString &attributedString) {
for (auto fragment : attributedString.getFragments()) {
folly::dynamic dynamicFragment = folly::dynamic::object();
dynamicFragment["string"] = fragment.string;
dynamicFragment["reactTag"] = fragment.parentShadowNode->getTag();
dynamicFragment["textAttributes"] = toDynamic(fragment.textAttributes);
fragments.push_back(dynamicFragment);
}