@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.
- package/README.md +23 -4
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/Props.cpp +31 -1
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/Props.h +6 -0
- package/ios/RNUITextView.mm +503 -41
- package/ios/RNUITextViewShadowNode.cpp +179 -16
- package/ios/RNUITextViewShadowNode.h +33 -1
- package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/Props.cpp +31 -1
- package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/Props.h +6 -0
- package/lib/commonjs/RNUITextViewChildNativeComponent.ts +9 -0
- package/lib/commonjs/Text.js +81 -23
- package/lib/commonjs/Text.js.map +1 -1
- package/lib/commonjs/press.js +23 -0
- package/lib/commonjs/press.js.map +1 -0
- package/lib/module/RNUITextViewChildNativeComponent.ts +9 -0
- package/lib/module/Text.js +82 -24
- package/lib/module/Text.js.map +1 -1
- package/lib/module/press.js +19 -0
- package/lib/module/press.js.map +1 -0
- package/lib/typescript/commonjs/example/src/App.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/RNUITextViewChildNativeComponent.d.ts +9 -0
- package/lib/typescript/commonjs/src/RNUITextViewChildNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/Text.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/press.d.ts +10 -0
- package/lib/typescript/commonjs/src/press.d.ts.map +1 -0
- package/lib/typescript/module/example/src/App.d.ts.map +1 -1
- package/lib/typescript/module/src/RNUITextViewChildNativeComponent.d.ts +9 -0
- package/lib/typescript/module/src/RNUITextViewChildNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/Text.d.ts.map +1 -1
- package/lib/typescript/module/src/press.d.ts +10 -0
- package/lib/typescript/module/src/press.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/RNUITextViewChildNativeComponent.ts +9 -0
- package/src/Text.tsx +80 -11
- package/src/press.ts +36 -0
package/README.md
CHANGED
|
@@ -54,10 +54,6 @@ pod install
|
|
|
54
54
|
React Native UITextView can - for the most part - be used as a drop-in replacement
|
|
55
55
|
for existing blocks of `Text`. However, there are a few limitations:
|
|
56
56
|
|
|
57
|
-
- Children of `UITextView` may only be other UITextView children (base `Text` children
|
|
58
|
-
will be converted to `UITextView` children, so you only need to adjust the wrapper).
|
|
59
|
-
This means that things like in-line images are not supported as they are in the base
|
|
60
|
-
React Native `Text` component.
|
|
61
57
|
- A few styles have not yet been implemented, but all should be possible.
|
|
62
58
|
|
|
63
59
|
## Usage
|
|
@@ -117,6 +113,29 @@ add to a link.
|
|
|
117
113
|
</Text>
|
|
118
114
|
```
|
|
119
115
|
|
|
116
|
+
Inline views are also supported and participate in text measurement and wrapping:
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
<Text selectable uiTextView>
|
|
120
|
+
Selectable text{' '}
|
|
121
|
+
<View
|
|
122
|
+
style={{
|
|
123
|
+
paddingHorizontal: 5,
|
|
124
|
+
paddingVertical: 2,
|
|
125
|
+
borderRadius: 999,
|
|
126
|
+
backgroundColor: '#e5e7eb',
|
|
127
|
+
}}>
|
|
128
|
+
<Text style={{fontSize: 12}}>1/3</Text>
|
|
129
|
+
</View>
|
|
130
|
+
</Text>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Pressable `UITextView` text uses the same rounded gray press highlight as
|
|
134
|
+
React Native `Text`. The highlight appears immediately, remains visible for at
|
|
135
|
+
least 130 ms on a quick tap, and covers non-pressable nested spans belonging to
|
|
136
|
+
the same pressable parent. Set `suppressHighlighting` to disable the visual
|
|
137
|
+
feedback without disabling `onPress` or `onLongPress`.
|
|
138
|
+
|
|
120
139
|
## Selection Detection
|
|
121
140
|
|
|
122
141
|
`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;
|