@bsky.app/react-native-uitextview 2.4.1 → 2.5.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 +6 -0
  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 +17 -2
  6. package/ios/RNUITextViewShadowNode.h +17 -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
package/README.md CHANGED
@@ -117,6 +117,12 @@ add to a link.
117
117
  </Text>
118
118
  ```
119
119
 
120
+ Pressable `UITextView` text uses the same rounded gray press highlight as
121
+ React Native `Text`. The highlight appears immediately, remains visible for at
122
+ least 130 ms on a quick tap, and covers non-pressable nested spans belonging to
123
+ the same pressable parent. Set `suppressHighlighting` to disable the visual
124
+ feedback without disabling `onPress` or `onLongPress`.
125
+
120
126
  ## Selection Detection
121
127
 
122
128
  `UITextView` supports native selection change events via the `onSelectionChange` callback.
@@ -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;