@bsky.app/react-native-uitextview 2.4.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +23 -4
  2. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/Props.cpp +31 -1
  3. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/Props.h +6 -0
  4. package/ios/RNUITextView.mm +503 -41
  5. package/ios/RNUITextViewShadowNode.cpp +179 -16
  6. package/ios/RNUITextViewShadowNode.h +33 -1
  7. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/Props.cpp +31 -1
  8. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/Props.h +6 -0
  9. package/lib/commonjs/RNUITextViewChildNativeComponent.ts +9 -0
  10. package/lib/commonjs/Text.js +81 -23
  11. package/lib/commonjs/Text.js.map +1 -1
  12. package/lib/commonjs/press.js +23 -0
  13. package/lib/commonjs/press.js.map +1 -0
  14. package/lib/module/RNUITextViewChildNativeComponent.ts +9 -0
  15. package/lib/module/Text.js +82 -24
  16. package/lib/module/Text.js.map +1 -1
  17. package/lib/module/press.js +19 -0
  18. package/lib/module/press.js.map +1 -0
  19. package/lib/typescript/commonjs/example/src/App.d.ts.map +1 -1
  20. package/lib/typescript/commonjs/src/RNUITextViewChildNativeComponent.d.ts +9 -0
  21. package/lib/typescript/commonjs/src/RNUITextViewChildNativeComponent.d.ts.map +1 -1
  22. package/lib/typescript/commonjs/src/Text.d.ts.map +1 -1
  23. package/lib/typescript/commonjs/src/press.d.ts +10 -0
  24. package/lib/typescript/commonjs/src/press.d.ts.map +1 -0
  25. package/lib/typescript/module/example/src/App.d.ts.map +1 -1
  26. package/lib/typescript/module/src/RNUITextViewChildNativeComponent.d.ts +9 -0
  27. package/lib/typescript/module/src/RNUITextViewChildNativeComponent.d.ts.map +1 -1
  28. package/lib/typescript/module/src/Text.d.ts.map +1 -1
  29. package/lib/typescript/module/src/press.d.ts +10 -0
  30. package/lib/typescript/module/src/press.d.ts.map +1 -0
  31. package/package.json +1 -1
  32. package/src/RNUITextViewChildNativeComponent.ts +9 -0
  33. package/src/Text.tsx +80 -11
  34. package/src/press.ts +36 -0
@@ -1,6 +1,8 @@
1
1
  #include "RNUITextViewShadowNode.h"
2
2
  #include "RNUITextViewChildShadowNode.h"
3
+ #include <react/debug/react_native_assert.h>
3
4
  #include <react/renderer/components/view/ViewShadowNode.h>
5
+ #include <react/renderer/graphics/rounding.h>
4
6
  #include <react/renderer/mounting/ShadowView.h>
5
7
 
6
8
  #include <cmath>
@@ -16,6 +18,22 @@ static ShadowView shadowViewFromShadowNode(const ShadowNode& shadowNode) {
16
18
  return shadowView;
17
19
  }
18
20
 
21
+ static ParagraphAttributes paragraphAttributesFromProps(
22
+ const RNUITextViewProps& props) {
23
+ auto paragraphAttributes = ParagraphAttributes{};
24
+ paragraphAttributes.maximumNumberOfLines = props.numberOfLines;
25
+ if (props.ellipsizeMode == RNUITextViewEllipsizeMode::Head) {
26
+ paragraphAttributes.ellipsizeMode = EllipsizeMode::Head;
27
+ } else if (props.ellipsizeMode == RNUITextViewEllipsizeMode::Middle) {
28
+ paragraphAttributes.ellipsizeMode = EllipsizeMode::Middle;
29
+ } else if (props.ellipsizeMode == RNUITextViewEllipsizeMode::Tail) {
30
+ paragraphAttributes.ellipsizeMode = EllipsizeMode::Tail;
31
+ } else if (props.ellipsizeMode == RNUITextViewEllipsizeMode::Clip) {
32
+ paragraphAttributes.ellipsizeMode = EllipsizeMode::Clip;
33
+ }
34
+ return paragraphAttributes;
35
+ }
36
+
19
37
  RNUITextViewShadowNode::RNUITextViewShadowNode(
20
38
  const ShadowNode& sourceShadowNode,
21
39
  const ShadowNodeFragment& fragment
@@ -26,19 +44,9 @@ Size RNUITextViewShadowNode::measureContent(
26
44
  const LayoutContext& layoutContext,
27
45
  const LayoutConstraints& layoutConstraints) const {
28
46
  const auto &baseProps = getConcreteProps();
29
- auto paragraphAttributes = ParagraphAttributes{};
30
- paragraphAttributes.maximumNumberOfLines = baseProps.numberOfLines;
31
- if (baseProps.ellipsizeMode == RNUITextViewEllipsizeMode::Head) {
32
- paragraphAttributes.ellipsizeMode = EllipsizeMode::Head;
33
- } else if (baseProps.ellipsizeMode == RNUITextViewEllipsizeMode::Middle) {
34
- paragraphAttributes.ellipsizeMode = EllipsizeMode::Middle;
35
- } else if (baseProps.ellipsizeMode == RNUITextViewEllipsizeMode::Tail) {
36
- paragraphAttributes.ellipsizeMode = EllipsizeMode::Tail;
37
- } else if (baseProps.ellipsizeMode == RNUITextViewEllipsizeMode::Clip) {
38
- paragraphAttributes.ellipsizeMode = EllipsizeMode::Clip;
39
- }
40
-
41
- const auto attributedString = getAttributedString(layoutContext);
47
+ const auto paragraphAttributes = paragraphAttributesFromProps(baseProps);
48
+ const auto content =
49
+ getContentWithMeasuredAttachments(layoutContext, layoutConstraints);
42
50
 
43
51
  TextLayoutContext textLayoutContext{
44
52
  .pointScaleFactor = layoutContext.pointScaleFactor,
@@ -47,15 +55,62 @@ Size RNUITextViewShadowNode::measureContent(
47
55
  const auto textLayoutManager = std::make_shared<const TextLayoutManager>(getContextContainer());
48
56
 
49
57
  return textLayoutManager->measure(
50
- AttributedStringBox{attributedString},
58
+ AttributedStringBox{content.attributedString},
51
59
  paragraphAttributes,
52
60
  textLayoutContext,
53
61
  layoutConstraints
54
62
  ).size;
55
63
  }
56
64
 
65
+ RNUITextViewContent RNUITextViewShadowNode::getContentWithMeasuredAttachments(
66
+ const LayoutContext& layoutContext,
67
+ const LayoutConstraints& layoutConstraints,
68
+ std::vector<RNUITextViewHighlightMetadata> *highlightMetadata) const {
69
+ auto attachments = std::vector<RNUITextViewAttachment>{};
70
+ auto attributedString =
71
+ getAttributedString(layoutContext, highlightMetadata, &attachments);
72
+
73
+ if (attachments.empty()) {
74
+ return RNUITextViewContent{
75
+ std::move(attributedString),
76
+ std::move(attachments),
77
+ };
78
+ }
79
+
80
+ auto localLayoutConstraints = layoutConstraints;
81
+ localLayoutConstraints.minimumSize = Size{0, 0};
82
+ auto &fragments = attributedString.getFragments();
83
+
84
+ for (const auto &attachment : attachments) {
85
+ const auto layoutableShadowNode =
86
+ dynamic_cast<const LayoutableShadowNode *>(attachment.shadowNode);
87
+ if (layoutableShadowNode == nullptr) {
88
+ continue;
89
+ }
90
+
91
+ auto size =
92
+ layoutableShadowNode->measure(layoutContext, localLayoutConstraints);
93
+ size.width += 0.01f;
94
+ size.height += 0.01f;
95
+ size = roundToPixel<&ceil>(size, layoutContext.pointScaleFactor);
96
+
97
+ auto fragmentLayoutMetrics = LayoutMetrics{};
98
+ fragmentLayoutMetrics.pointScaleFactor = layoutContext.pointScaleFactor;
99
+ fragmentLayoutMetrics.frame.size = size;
100
+ fragments[attachment.fragmentIndex].parentShadowView.layoutMetrics =
101
+ fragmentLayoutMetrics;
102
+ }
103
+
104
+ return RNUITextViewContent{
105
+ std::move(attributedString),
106
+ std::move(attachments),
107
+ };
108
+ }
109
+
57
110
  AttributedString RNUITextViewShadowNode::getAttributedString(
58
- const LayoutContext& layoutContext) const {
111
+ const LayoutContext& layoutContext,
112
+ std::vector<RNUITextViewHighlightMetadata> *highlightMetadata,
113
+ std::vector<RNUITextViewAttachment> *attachments) const {
59
114
  const auto &baseProps = getConcreteProps();
60
115
  auto baseTextAttributes = TextAttributes::defaultTextAttributes();
61
116
  baseTextAttributes.backgroundColor = baseProps.backgroundColor;
@@ -142,7 +197,29 @@ AttributedString RNUITextViewShadowNode::getAttributedString(
142
197
  fragment.textAttributes = textAttributes;
143
198
  fragment.parentShadowView = shadowViewFromShadowNode(*textViewChild);
144
199
 
200
+ if (highlightMetadata != nullptr && !props.highlightGroup.empty()) {
201
+ highlightMetadata->push_back(RNUITextViewHighlightMetadata{
202
+ fragment.parentShadowView.tag,
203
+ props.highlightGroup,
204
+ props.suppressHighlighting,
205
+ props.pressRetentionOffsetTop,
206
+ props.pressRetentionOffsetRight,
207
+ props.pressRetentionOffsetBottom,
208
+ props.pressRetentionOffsetLeft,
209
+ });
210
+ }
211
+
145
212
  baseAttributedString.appendFragment(std::move(fragment));
213
+ } else if (attachments != nullptr) {
214
+ auto fragment = AttributedString::Fragment{};
215
+ fragment.string = AttributedString::Fragment::AttachmentCharacter();
216
+ fragment.textAttributes = baseTextAttributes;
217
+ fragment.parentShadowView = shadowViewFromShadowNode(*child);
218
+ baseAttributedString.appendFragment(std::move(fragment));
219
+ attachments->push_back(RNUITextViewAttachment{
220
+ child,
221
+ baseAttributedString.getFragments().size() - 1,
222
+ });
146
223
  }
147
224
  }
148
225
 
@@ -151,8 +228,94 @@ AttributedString RNUITextViewShadowNode::getAttributedString(
151
228
 
152
229
  void RNUITextViewShadowNode::layout(LayoutContext layoutContext) {
153
230
  ensureUnsealed();
231
+ const auto layoutMetrics = getLayoutMetrics();
232
+ const auto size = layoutMetrics.getContentFrame().size;
233
+ const auto layoutConstraints = LayoutConstraints{
234
+ size,
235
+ size,
236
+ layoutMetrics.layoutDirection,
237
+ };
238
+ auto highlightMetadata = std::vector<RNUITextViewHighlightMetadata>{};
239
+ auto content = getContentWithMeasuredAttachments(
240
+ layoutContext, layoutConstraints, &highlightMetadata);
241
+
154
242
  setStateData(RNUITextViewStateReal{
155
- getAttributedString(layoutContext)
243
+ content.attributedString,
244
+ std::move(highlightMetadata),
156
245
  });
246
+
247
+ if (content.attachments.empty()) {
248
+ return;
249
+ }
250
+
251
+ const auto paragraphAttributes =
252
+ paragraphAttributesFromProps(getConcreteProps());
253
+ const auto textLayoutContext = TextLayoutContext{
254
+ .pointScaleFactor = layoutContext.pointScaleFactor,
255
+ .surfaceId = getSurfaceId(),
256
+ };
257
+ const auto textLayoutManager =
258
+ std::make_shared<const TextLayoutManager>(getContextContainer());
259
+ const auto measurement = textLayoutManager->measure(
260
+ AttributedStringBox{content.attributedString},
261
+ paragraphAttributes,
262
+ textLayoutContext,
263
+ layoutConstraints);
264
+
265
+ react_native_assert(
266
+ content.attachments.size() == measurement.attachments.size());
267
+
268
+ auto textViewShadowNode = this;
269
+ auto textViewOwningShadowNode = std::shared_ptr<ShadowNode>{};
270
+
271
+ for (size_t i = 0; i < content.attachments.size(); i++) {
272
+ const auto &attachment = content.attachments[i];
273
+ if (dynamic_cast<const LayoutableShadowNode *>(attachment.shadowNode) ==
274
+ nullptr) {
275
+ continue;
276
+ }
277
+
278
+ auto clonedShadowNode = std::shared_ptr<ShadowNode>{};
279
+ textViewOwningShadowNode = textViewShadowNode->cloneTree(
280
+ attachment.shadowNode->getFamily(),
281
+ [&](const ShadowNode& oldShadowNode) {
282
+ clonedShadowNode = oldShadowNode.clone({});
283
+ return clonedShadowNode;
284
+ });
285
+ textViewShadowNode =
286
+ static_cast<RNUITextViewShadowNode *>(textViewOwningShadowNode.get());
287
+
288
+ auto &layoutableShadowNode =
289
+ dynamic_cast<LayoutableShadowNode &>(*clonedShadowNode);
290
+ const auto &attachmentMeasurement = measurement.attachments[i];
291
+ if (attachmentMeasurement.isClipped) {
292
+ layoutableShadowNode.setLayoutMetrics(
293
+ LayoutMetrics{.frame = {}, .displayType = DisplayType::None});
294
+ continue;
295
+ }
296
+
297
+ auto attachmentFrame = attachmentMeasurement.frame;
298
+ attachmentFrame.origin.x += layoutMetrics.contentInsets.left;
299
+ attachmentFrame.origin.y += layoutMetrics.contentInsets.top;
300
+ const auto attachmentSize = roundToPixel<&ceil>(
301
+ attachmentFrame.size, layoutMetrics.pointScaleFactor);
302
+ const auto attachmentOrigin = roundToPixel<&round>(
303
+ attachmentFrame.origin, layoutMetrics.pointScaleFactor);
304
+ const auto attachmentLayoutConstraints = LayoutConstraints{
305
+ attachmentSize,
306
+ attachmentSize,
307
+ layoutConstraints.layoutDirection,
308
+ };
309
+
310
+ layoutableShadowNode.layoutTree(
311
+ layoutContext, attachmentLayoutConstraints);
312
+ auto attachmentLayoutMetrics = layoutableShadowNode.getLayoutMetrics();
313
+ attachmentLayoutMetrics.frame.origin = attachmentOrigin;
314
+ layoutableShadowNode.setLayoutMetrics(attachmentLayoutMetrics);
315
+ }
316
+
317
+ if (textViewShadowNode != this) {
318
+ children_ = textViewShadowNode->children_;
319
+ }
157
320
  }
158
321
  }
@@ -7,13 +7,37 @@
7
7
  #include <react/renderer/core/LayoutContext.h>
8
8
  #include <react/renderer/core/ShadowNode.h>
9
9
 
10
+ #include <string>
11
+ #include <vector>
12
+
10
13
  namespace facebook::react {
11
14
 
12
15
  extern const char RNUITextViewComponentName[];
13
16
 
17
+ struct RNUITextViewHighlightMetadata {
18
+ Tag tag;
19
+ std::string group;
20
+ bool suppressHighlighting;
21
+ Float pressRetentionOffsetTop;
22
+ Float pressRetentionOffsetRight;
23
+ Float pressRetentionOffsetBottom;
24
+ Float pressRetentionOffsetLeft;
25
+ };
26
+
27
+ struct RNUITextViewAttachment {
28
+ const ShadowNode *shadowNode;
29
+ size_t fragmentIndex;
30
+ };
31
+
32
+ struct RNUITextViewContent {
33
+ AttributedString attributedString;
34
+ std::vector<RNUITextViewAttachment> attachments;
35
+ };
36
+
14
37
  class RNUITextViewStateReal final {
15
38
  public:
16
39
  AttributedString attributedString;
40
+ std::vector<RNUITextViewHighlightMetadata> highlightMetadata;
17
41
  };
18
42
 
19
43
  class RNUITextViewShadowNode final : public ConcreteViewShadowNode<
@@ -43,6 +67,14 @@ public:
43
67
  const LayoutConstraints& layoutConstraints) const override;
44
68
 
45
69
  private:
46
- AttributedString getAttributedString(const LayoutContext& layoutContext) const;
70
+ RNUITextViewContent getContentWithMeasuredAttachments(
71
+ const LayoutContext& layoutContext,
72
+ const LayoutConstraints& layoutConstraints,
73
+ std::vector<RNUITextViewHighlightMetadata> *highlightMetadata = nullptr) const;
74
+
75
+ AttributedString getAttributedString(
76
+ const LayoutContext& layoutContext,
77
+ std::vector<RNUITextViewHighlightMetadata> *highlightMetadata = nullptr,
78
+ std::vector<RNUITextViewAttachment> *attachments = nullptr) const;
47
79
  };
48
80
  } // namespace facebook::React
@@ -31,7 +31,13 @@ RNUITextViewChildProps::RNUITextViewChildProps(
31
31
  textDecorationStyle(convertRawProp(context, rawProps, "textDecorationStyle", sourceProps.textDecorationStyle, {RNUITextViewChildTextDecorationStyle::Solid})),
32
32
  textDecorationColor(convertRawProp(context, rawProps, "textDecorationColor", sourceProps.textDecorationColor, {})),
33
33
  textAlign(convertRawProp(context, rawProps, "textAlign", sourceProps.textAlign, {RNUITextViewChildTextAlign::Auto})),
34
- shadowRadius(convertRawProp(context, rawProps, "shadowRadius", sourceProps.shadowRadius, {0.0})) {}
34
+ shadowRadius(convertRawProp(context, rawProps, "shadowRadius", sourceProps.shadowRadius, {0.0})),
35
+ highlightGroup(convertRawProp(context, rawProps, "highlightGroup", sourceProps.highlightGroup, {})),
36
+ suppressHighlighting(convertRawProp(context, rawProps, "suppressHighlighting", sourceProps.suppressHighlighting, {false})),
37
+ pressRetentionOffsetTop(convertRawProp(context, rawProps, "pressRetentionOffsetTop", sourceProps.pressRetentionOffsetTop, {20.0})),
38
+ pressRetentionOffsetRight(convertRawProp(context, rawProps, "pressRetentionOffsetRight", sourceProps.pressRetentionOffsetRight, {20.0})),
39
+ pressRetentionOffsetBottom(convertRawProp(context, rawProps, "pressRetentionOffsetBottom", sourceProps.pressRetentionOffsetBottom, {30.0})),
40
+ pressRetentionOffsetLeft(convertRawProp(context, rawProps, "pressRetentionOffsetLeft", sourceProps.pressRetentionOffsetLeft, {20.0})) {}
35
41
 
36
42
  #ifdef RN_SERIALIZABLE_STATE
37
43
  ComponentName RNUITextViewChildProps::getDiffPropsImplementationTarget() const {
@@ -100,6 +106,30 @@ folly::dynamic RNUITextViewChildProps::getDiffProps(
100
106
  if ((shadowRadius != oldProps->shadowRadius) && !(std::isnan(shadowRadius) && std::isnan(oldProps->shadowRadius))) {
101
107
  result["shadowRadius"] = shadowRadius;
102
108
  }
109
+
110
+ if (highlightGroup != oldProps->highlightGroup) {
111
+ result["highlightGroup"] = highlightGroup;
112
+ }
113
+
114
+ if (suppressHighlighting != oldProps->suppressHighlighting) {
115
+ result["suppressHighlighting"] = suppressHighlighting;
116
+ }
117
+
118
+ if ((pressRetentionOffsetTop != oldProps->pressRetentionOffsetTop) && !(std::isnan(pressRetentionOffsetTop) && std::isnan(oldProps->pressRetentionOffsetTop))) {
119
+ result["pressRetentionOffsetTop"] = pressRetentionOffsetTop;
120
+ }
121
+
122
+ if ((pressRetentionOffsetRight != oldProps->pressRetentionOffsetRight) && !(std::isnan(pressRetentionOffsetRight) && std::isnan(oldProps->pressRetentionOffsetRight))) {
123
+ result["pressRetentionOffsetRight"] = pressRetentionOffsetRight;
124
+ }
125
+
126
+ if ((pressRetentionOffsetBottom != oldProps->pressRetentionOffsetBottom) && !(std::isnan(pressRetentionOffsetBottom) && std::isnan(oldProps->pressRetentionOffsetBottom))) {
127
+ result["pressRetentionOffsetBottom"] = pressRetentionOffsetBottom;
128
+ }
129
+
130
+ if ((pressRetentionOffsetLeft != oldProps->pressRetentionOffsetLeft) && !(std::isnan(pressRetentionOffsetLeft) && std::isnan(oldProps->pressRetentionOffsetLeft))) {
131
+ result["pressRetentionOffsetLeft"] = pressRetentionOffsetLeft;
132
+ }
103
133
  return result;
104
134
  }
105
135
  #endif
@@ -174,6 +174,12 @@ class RNUITextViewChildProps final : public ViewProps {
174
174
  SharedColor textDecorationColor{};
175
175
  RNUITextViewChildTextAlign textAlign{RNUITextViewChildTextAlign::Auto};
176
176
  Float shadowRadius{0.0};
177
+ std::string highlightGroup{};
178
+ bool suppressHighlighting{false};
179
+ Float pressRetentionOffsetTop{20.0};
180
+ Float pressRetentionOffsetRight{20.0};
181
+ Float pressRetentionOffsetBottom{30.0};
182
+ Float pressRetentionOffsetLeft{20.0};
177
183
 
178
184
  #ifdef RN_SERIALIZABLE_STATE
179
185
  ComponentName getDiffPropsImplementationTarget() const override;
@@ -40,6 +40,15 @@ interface NativeProps extends ViewProps {
40
40
  textDecorationColor?: ColorValue
41
41
  textAlign?: CodegenTypes.WithDefault<TextAlign, 'auto'>
42
42
  shadowRadius?: CodegenTypes.WithDefault<CodegenTypes.Float, 0>
43
+ /** Internal identifier used to highlight all fragments in a pressable Text. */
44
+ highlightGroup?: string
45
+ /** Internal copy of Text's suppressHighlighting prop. */
46
+ suppressHighlighting?: boolean
47
+ /** Internal expansion of the owning Text's press-retention rectangle. */
48
+ pressRetentionOffsetTop?: CodegenTypes.WithDefault<CodegenTypes.Float, 20>
49
+ pressRetentionOffsetRight?: CodegenTypes.WithDefault<CodegenTypes.Float, 20>
50
+ pressRetentionOffsetBottom?: CodegenTypes.WithDefault<CodegenTypes.Float, 30>
51
+ pressRetentionOffsetLeft?: CodegenTypes.WithDefault<CodegenTypes.Float, 20>
43
52
  onPress?: CodegenTypes.BubblingEventHandler<TargetedEvent>
44
53
  onLongPress?: CodegenTypes.BubblingEventHandler<TargetedEvent>
45
54
  }
@@ -8,10 +8,14 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _RNUITextViewChildNativeComponent = _interopRequireDefault(require("./RNUITextViewChildNativeComponent"));
10
10
  var _RNUITextViewNativeComponent = _interopRequireDefault(require("./RNUITextViewNativeComponent"));
11
+ var _press = require("./press.js");
11
12
  var _util = require("./util.js");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- const TextAncestorContext = /*#__PURE__*/_react.default.createContext([false, _reactNative.StyleSheet.create({})]);
15
+ const TextAncestorContext = /*#__PURE__*/_react.default.createContext({
16
+ isAncestor: false,
17
+ rootStyle: _reactNative.StyleSheet.create({})
18
+ });
15
19
  const textDefaults = {
16
20
  allowFontScaling: true,
17
21
  selectable: true
@@ -28,13 +32,48 @@ function UITextViewChild({
28
32
  children,
29
33
  ...rest
30
34
  }) {
31
- const [isAncestor, rootStyle] = useTextAncestorContext();
35
+ const {
36
+ isAncestor,
37
+ rootStyle,
38
+ highlightGroup: ancestorHighlightGroup,
39
+ suppressHighlighting: ancestorSuppressHighlighting,
40
+ pressRetentionOffset: ancestorPressRetentionOffset,
41
+ onPress: ancestorOnPress,
42
+ onLongPress: ancestorOnLongPress
43
+ } = useTextAncestorContext();
44
+ const ownHighlightGroup = _react.default.useId();
45
+ const {
46
+ highlightGroup,
47
+ suppressHighlighting,
48
+ pressRetentionOffset,
49
+ onPress,
50
+ onLongPress
51
+ } = (0, _press.resolvePressContext)(ownHighlightGroup, rest, {
52
+ highlightGroup: ancestorHighlightGroup,
53
+ suppressHighlighting: ancestorSuppressHighlighting,
54
+ pressRetentionOffset: ancestorPressRetentionOffset,
55
+ onPress: ancestorOnPress,
56
+ onLongPress: ancestorOnLongPress
57
+ });
58
+ // The native event currently contains only `target`, while TextProps types
59
+ // these callbacks as full gesture events. Preserve the existing public type
60
+ // and adapt it only at the private Codegen boundary.
61
+ const nativeOnPress = onPress;
62
+ const nativeOnLongPress = onLongPress;
32
63
 
33
64
  // Flatten the styles, and apply the root styles when needed
34
65
  const flattenedStyle = _react.default.useMemo(() => (0, _util.flattenStyles)(rootStyle, style), [rootStyle, style]);
35
66
  if (!isAncestor) {
36
67
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextAncestorContext.Provider, {
37
- value: [true, flattenedStyle],
68
+ value: {
69
+ isAncestor: true,
70
+ rootStyle: flattenedStyle,
71
+ highlightGroup,
72
+ suppressHighlighting,
73
+ pressRetentionOffset,
74
+ onPress,
75
+ onLongPress
76
+ },
38
77
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RNUITextViewNativeComponent.default, {
39
78
  ...textDefaults,
40
79
  ...rest,
@@ -48,35 +87,52 @@ function UITextViewChild({
48
87
  if (/*#__PURE__*/_react.default.isValidElement(c)) {
49
88
  return c;
50
89
  } else if (typeof c === 'string' || typeof c === 'number') {
51
- return (
52
- /*#__PURE__*/
53
- // @ts-expect-error @TODO fix this type
54
- (0, _jsxRuntime.jsx)(_RNUITextViewChildNativeComponent.default, {
55
- style: flattenedStyle,
56
- text: c.toString(),
57
- ...rest
58
- }, index)
59
- );
90
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RNUITextViewChildNativeComponent.default, {
91
+ style: flattenedStyle,
92
+ text: c.toString(),
93
+ ...rest,
94
+ highlightGroup: highlightGroup,
95
+ suppressHighlighting: suppressHighlighting,
96
+ pressRetentionOffsetTop: pressRetentionOffset?.top,
97
+ pressRetentionOffsetRight: pressRetentionOffset?.right,
98
+ pressRetentionOffsetBottom: pressRetentionOffset?.bottom,
99
+ pressRetentionOffsetLeft: pressRetentionOffset?.left,
100
+ onPress: nativeOnPress,
101
+ onLongPress: nativeOnLongPress
102
+ }, index);
60
103
  }
61
104
  return null;
62
105
  })
63
106
  })
64
107
  });
65
108
  } else {
66
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
109
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextAncestorContext.Provider, {
110
+ value: {
111
+ isAncestor: true,
112
+ rootStyle: flattenedStyle,
113
+ highlightGroup,
114
+ suppressHighlighting,
115
+ pressRetentionOffset,
116
+ onPress,
117
+ onLongPress
118
+ },
67
119
  children: _react.default.Children.toArray(children).map((c, index) => {
68
120
  if (/*#__PURE__*/_react.default.isValidElement(c)) {
69
121
  return c;
70
122
  } else if (typeof c === 'string' || typeof c === 'number') {
71
- return (
72
- /*#__PURE__*/
73
- // @ts-expect-error @TODO fix this type
74
- (0, _jsxRuntime.jsx)(_RNUITextViewChildNativeComponent.default, {
75
- style: flattenedStyle,
76
- text: c.toString(),
77
- ...rest
78
- }, index)
79
- );
123
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RNUITextViewChildNativeComponent.default, {
124
+ style: flattenedStyle,
125
+ text: c.toString(),
126
+ ...rest,
127
+ highlightGroup: highlightGroup,
128
+ suppressHighlighting: suppressHighlighting,
129
+ pressRetentionOffsetTop: pressRetentionOffset?.top,
130
+ pressRetentionOffsetRight: pressRetentionOffset?.right,
131
+ pressRetentionOffsetBottom: pressRetentionOffset?.bottom,
132
+ pressRetentionOffsetLeft: pressRetentionOffset?.left,
133
+ onPress: nativeOnPress,
134
+ onLongPress: nativeOnLongPress
135
+ }, index);
80
136
  }
81
137
  return null;
82
138
  })
@@ -84,7 +140,9 @@ function UITextViewChild({
84
140
  }
85
141
  }
86
142
  function UITextViewInner(props) {
87
- const [isAncestor] = useTextAncestorContext();
143
+ const {
144
+ isAncestor
145
+ } = useTextAncestorContext();
88
146
 
89
147
  // Even if the uiTextView prop is set, we can still default to using
90
148
  // normal selection (i.e. base RN text) if the text doesn't need to be
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_RNUITextViewChildNativeComponent","_RNUITextViewNativeComponent","_util","_jsxRuntime","e","__esModule","default","TextAncestorContext","React","createContext","StyleSheet","create","textDefaults","allowFontScaling","selectable","useTextAncestorContext","useContext","UITextViewChild","style","children","rest","isAncestor","rootStyle","flattenedStyle","useMemo","flattenStyles","jsx","Provider","value","onPress","undefined","onLongPress","Children","toArray","map","c","index","isValidElement","text","toString","Fragment","UITextViewInner","props","uiTextView","Text","UITextView","Platform","OS"],"sourceRoot":"../../src","sources":["Text.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,iCAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,4BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAAoC,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,MAAMG,mBAAmB,gBAAGC,cAAK,CAACC,aAAa,CAAuB,CACpE,KAAK,EACLC,uBAAU,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC,CACt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yB;EAAK,CAAG,CAAC;AACvC;AAEO,SAASG,UAAUA,CAACH,KAAsB,EAAE;EACjD,IAAII,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB,oBAAO,IAAA5C,WAAA,CAAAuB,GAAA,EAAC3B,YAAA,CAAA6C,IAAM;MAAA,GAAKF;IAAK,CAAG,CAAC;EAC9B;EACA,oBAAO,IAAAvC,WAAA,CAAAuB,GAAA,EAACe,eAAe;IAAA,GAAKC;EAAK,CAAG,CAAC;AACvC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_RNUITextViewChildNativeComponent","_RNUITextViewNativeComponent","_press","_util","_jsxRuntime","e","__esModule","default","TextAncestorContext","React","createContext","isAncestor","rootStyle","StyleSheet","create","textDefaults","allowFontScaling","selectable","useTextAncestorContext","useContext","UITextViewChild","style","children","rest","highlightGroup","ancestorHighlightGroup","suppressHighlighting","ancestorSuppressHighlighting","pressRetentionOffset","ancestorPressRetentionOffset","onPress","ancestorOnPress","onLongPress","ancestorOnLongPress","ownHighlightGroup","useId","resolvePressContext","nativeOnPress","nativeOnLongPress","flattenedStyle","useMemo","flattenStyles","jsx","Provider","value","undefined","Children","toArray","map","c","index","isValidElement","text","toString","pressRetentionOffsetTop","top","pressRetentionOffsetRight","right","pressRetentionOffsetBottom","bottom","pressRetentionOffsetLeft","left","UITextViewInner","props","uiTextView","Text","UITextView","Platform","OS"],"sourceRoot":"../../src","sources":["Text.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,iCAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,4BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAAoC,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAD,uBAAAQ,CAAA,WA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C,CAC0B,CAAC;EAEnC;AACF;AAEA,SAASY,eAAeA,CAACC,KAAsB,EAAE;EAC/C,MAAM;IAACpD;EAAU,CAAC,GAAGO,sBAAsB,CAAC,CAAC;;EAE7C;EACA;EACA;EACA,IAAI,CAAC,CAAC6C,KAAK,CAAC9C,UAAU,IAAI,CAAC8C,KAAK,CAACC,UAAU,KAAK,CAACrD,UAAU,EAAE;IAC3D,oBAAO,IAAAP,WAAA,CAAAsC,GAAA,EAAC3C,YAAA,CAAAkE,IAAM;MAAA,GAAKF;IAAK,CAAG,CAAC;EAC9B;EACA,oBAAO,IAAA3D,WAAA,CAAAsC,GAAA,EAACtB,eAAe;IAAA,GAAK2C;EAAK,CAAG,CAAC;AACvC;AAEO,SAASG,UAAUA,CAACH,KAAsB,EAAE;EACjD,IAAII,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB,oBAAO,IAAAhE,WAAA,CAAAsC,GAAA,EAAC3C,YAAA,CAAAkE,IAAM;MAAA,GAAKF;IAAK,CAAG,CAAC;EAC9B;EACA,oBAAO,IAAA3D,WAAA,CAAAsC,GAAA,EAACoB,eAAe;IAAA,GAAKC;EAAK,CAAG,CAAC;AACvC","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.resolvePressContext = resolvePressContext;
7
+ function resolvePressContext(ownHighlightGroup, props, ancestor) {
8
+ const isPressable = props.onPress != null || props.onLongPress != null;
9
+ if (!isPressable) {
10
+ return ancestor;
11
+ }
12
+ return {
13
+ // Keep handler capabilities in the identifier that native already uses to
14
+ // group highlighted fragments. This avoids a separate prop/state channel
15
+ // getting out of sync with the group and its event emitter.
16
+ highlightGroup: `${ownHighlightGroup}|${props.onPress ? 'p' : ''}${props.onLongPress ? 'l' : ''}`,
17
+ suppressHighlighting: props.suppressHighlighting === true,
18
+ pressRetentionOffset: props.pressRetentionOffset,
19
+ onPress: props.onPress,
20
+ onLongPress: props.onLongPress
21
+ };
22
+ }
23
+ //# sourceMappingURL=press.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["resolvePressContext","ownHighlightGroup","props","ancestor","isPressable","onPress","onLongPress","highlightGroup","suppressHighlighting","pressRetentionOffset"],"sourceRoot":"../../src","sources":["press.ts"],"mappings":";;;;;;AAUO,SAASA,mBAAmBA,CACjCC,iBAAyB,EACzBC,KAGC,EACDC,QAAsB,EACR;EACd,MAAMC,WAAW,GAAGF,KAAK,CAACG,OAAO,IAAI,IAAI,IAAIH,KAAK,CAACI,WAAW,IAAI,IAAI;EACtE,IAAI,CAACF,WAAW,EAAE;IAChB,OAAOD,QAAQ;EACjB;EAEA,OAAO;IACL;IACA;IACA;IACAI,cAAc,EAAE,GAAGN,iBAAiB,IAAIC,KAAK,CAACG,OAAO,GAAG,GAAG,GAAG,EAAE,GAC9DH,KAAK,CAACI,WAAW,GAAG,GAAG,GAAG,EAAE,EAC5B;IACFE,oBAAoB,EAAEN,KAAK,CAACM,oBAAoB,KAAK,IAAI;IACzDC,oBAAoB,EAAEP,KAAK,CAACO,oBAAoB;IAChDJ,OAAO,EAAEH,KAAK,CAACG,OAAO;IACtBC,WAAW,EAAEJ,KAAK,CAACI;EACrB,CAAC;AACH","ignoreList":[]}
@@ -40,6 +40,15 @@ interface NativeProps extends ViewProps {
40
40
  textDecorationColor?: ColorValue
41
41
  textAlign?: CodegenTypes.WithDefault<TextAlign, 'auto'>
42
42
  shadowRadius?: CodegenTypes.WithDefault<CodegenTypes.Float, 0>
43
+ /** Internal identifier used to highlight all fragments in a pressable Text. */
44
+ highlightGroup?: string
45
+ /** Internal copy of Text's suppressHighlighting prop. */
46
+ suppressHighlighting?: boolean
47
+ /** Internal expansion of the owning Text's press-retention rectangle. */
48
+ pressRetentionOffsetTop?: CodegenTypes.WithDefault<CodegenTypes.Float, 20>
49
+ pressRetentionOffsetRight?: CodegenTypes.WithDefault<CodegenTypes.Float, 20>
50
+ pressRetentionOffsetBottom?: CodegenTypes.WithDefault<CodegenTypes.Float, 30>
51
+ pressRetentionOffsetLeft?: CodegenTypes.WithDefault<CodegenTypes.Float, 20>
43
52
  onPress?: CodegenTypes.BubblingEventHandler<TargetedEvent>
44
53
  onLongPress?: CodegenTypes.BubblingEventHandler<TargetedEvent>
45
54
  }