@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/lib/module/Text.js
CHANGED
|
@@ -4,9 +4,13 @@ import React from 'react';
|
|
|
4
4
|
import { Platform, StyleSheet, Text as RNText } from 'react-native';
|
|
5
5
|
import RNUITextViewChildNativeComponent from './RNUITextViewChildNativeComponent';
|
|
6
6
|
import RNUITextViewNativeComponent from './RNUITextViewNativeComponent';
|
|
7
|
+
import { resolvePressContext } from "./press.js";
|
|
7
8
|
import { flattenStyles } from "./util.js";
|
|
8
|
-
import { jsx as _jsx
|
|
9
|
-
const TextAncestorContext = /*#__PURE__*/React.createContext(
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
const TextAncestorContext = /*#__PURE__*/React.createContext({
|
|
11
|
+
isAncestor: false,
|
|
12
|
+
rootStyle: StyleSheet.create({})
|
|
13
|
+
});
|
|
10
14
|
const textDefaults = {
|
|
11
15
|
allowFontScaling: true,
|
|
12
16
|
selectable: true
|
|
@@ -23,13 +27,48 @@ function UITextViewChild({
|
|
|
23
27
|
children,
|
|
24
28
|
...rest
|
|
25
29
|
}) {
|
|
26
|
-
const
|
|
30
|
+
const {
|
|
31
|
+
isAncestor,
|
|
32
|
+
rootStyle,
|
|
33
|
+
highlightGroup: ancestorHighlightGroup,
|
|
34
|
+
suppressHighlighting: ancestorSuppressHighlighting,
|
|
35
|
+
pressRetentionOffset: ancestorPressRetentionOffset,
|
|
36
|
+
onPress: ancestorOnPress,
|
|
37
|
+
onLongPress: ancestorOnLongPress
|
|
38
|
+
} = useTextAncestorContext();
|
|
39
|
+
const ownHighlightGroup = React.useId();
|
|
40
|
+
const {
|
|
41
|
+
highlightGroup,
|
|
42
|
+
suppressHighlighting,
|
|
43
|
+
pressRetentionOffset,
|
|
44
|
+
onPress,
|
|
45
|
+
onLongPress
|
|
46
|
+
} = resolvePressContext(ownHighlightGroup, rest, {
|
|
47
|
+
highlightGroup: ancestorHighlightGroup,
|
|
48
|
+
suppressHighlighting: ancestorSuppressHighlighting,
|
|
49
|
+
pressRetentionOffset: ancestorPressRetentionOffset,
|
|
50
|
+
onPress: ancestorOnPress,
|
|
51
|
+
onLongPress: ancestorOnLongPress
|
|
52
|
+
});
|
|
53
|
+
// The native event currently contains only `target`, while TextProps types
|
|
54
|
+
// these callbacks as full gesture events. Preserve the existing public type
|
|
55
|
+
// and adapt it only at the private Codegen boundary.
|
|
56
|
+
const nativeOnPress = onPress;
|
|
57
|
+
const nativeOnLongPress = onLongPress;
|
|
27
58
|
|
|
28
59
|
// Flatten the styles, and apply the root styles when needed
|
|
29
60
|
const flattenedStyle = React.useMemo(() => flattenStyles(rootStyle, style), [rootStyle, style]);
|
|
30
61
|
if (!isAncestor) {
|
|
31
62
|
return /*#__PURE__*/_jsx(TextAncestorContext.Provider, {
|
|
32
|
-
value:
|
|
63
|
+
value: {
|
|
64
|
+
isAncestor: true,
|
|
65
|
+
rootStyle: flattenedStyle,
|
|
66
|
+
highlightGroup,
|
|
67
|
+
suppressHighlighting,
|
|
68
|
+
pressRetentionOffset,
|
|
69
|
+
onPress,
|
|
70
|
+
onLongPress
|
|
71
|
+
},
|
|
33
72
|
children: /*#__PURE__*/_jsx(RNUITextViewNativeComponent, {
|
|
34
73
|
...textDefaults,
|
|
35
74
|
...rest,
|
|
@@ -43,35 +82,52 @@ function UITextViewChild({
|
|
|
43
82
|
if (/*#__PURE__*/React.isValidElement(c)) {
|
|
44
83
|
return c;
|
|
45
84
|
} else if (typeof c === 'string' || typeof c === 'number') {
|
|
46
|
-
return (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
85
|
+
return /*#__PURE__*/_jsx(RNUITextViewChildNativeComponent, {
|
|
86
|
+
style: flattenedStyle,
|
|
87
|
+
text: c.toString(),
|
|
88
|
+
...rest,
|
|
89
|
+
highlightGroup: highlightGroup,
|
|
90
|
+
suppressHighlighting: suppressHighlighting,
|
|
91
|
+
pressRetentionOffsetTop: pressRetentionOffset?.top,
|
|
92
|
+
pressRetentionOffsetRight: pressRetentionOffset?.right,
|
|
93
|
+
pressRetentionOffsetBottom: pressRetentionOffset?.bottom,
|
|
94
|
+
pressRetentionOffsetLeft: pressRetentionOffset?.left,
|
|
95
|
+
onPress: nativeOnPress,
|
|
96
|
+
onLongPress: nativeOnLongPress
|
|
97
|
+
}, index);
|
|
55
98
|
}
|
|
56
99
|
return null;
|
|
57
100
|
})
|
|
58
101
|
})
|
|
59
102
|
});
|
|
60
103
|
} else {
|
|
61
|
-
return /*#__PURE__*/_jsx(
|
|
104
|
+
return /*#__PURE__*/_jsx(TextAncestorContext.Provider, {
|
|
105
|
+
value: {
|
|
106
|
+
isAncestor: true,
|
|
107
|
+
rootStyle: flattenedStyle,
|
|
108
|
+
highlightGroup,
|
|
109
|
+
suppressHighlighting,
|
|
110
|
+
pressRetentionOffset,
|
|
111
|
+
onPress,
|
|
112
|
+
onLongPress
|
|
113
|
+
},
|
|
62
114
|
children: React.Children.toArray(children).map((c, index) => {
|
|
63
115
|
if (/*#__PURE__*/React.isValidElement(c)) {
|
|
64
116
|
return c;
|
|
65
117
|
} else if (typeof c === 'string' || typeof c === 'number') {
|
|
66
|
-
return (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
118
|
+
return /*#__PURE__*/_jsx(RNUITextViewChildNativeComponent, {
|
|
119
|
+
style: flattenedStyle,
|
|
120
|
+
text: c.toString(),
|
|
121
|
+
...rest,
|
|
122
|
+
highlightGroup: highlightGroup,
|
|
123
|
+
suppressHighlighting: suppressHighlighting,
|
|
124
|
+
pressRetentionOffsetTop: pressRetentionOffset?.top,
|
|
125
|
+
pressRetentionOffsetRight: pressRetentionOffset?.right,
|
|
126
|
+
pressRetentionOffsetBottom: pressRetentionOffset?.bottom,
|
|
127
|
+
pressRetentionOffsetLeft: pressRetentionOffset?.left,
|
|
128
|
+
onPress: nativeOnPress,
|
|
129
|
+
onLongPress: nativeOnLongPress
|
|
130
|
+
}, index);
|
|
75
131
|
}
|
|
76
132
|
return null;
|
|
77
133
|
})
|
|
@@ -79,7 +135,9 @@ function UITextViewChild({
|
|
|
79
135
|
}
|
|
80
136
|
}
|
|
81
137
|
function UITextViewInner(props) {
|
|
82
|
-
const
|
|
138
|
+
const {
|
|
139
|
+
isAncestor
|
|
140
|
+
} = useTextAncestorContext();
|
|
83
141
|
|
|
84
142
|
// Even if the uiTextView prop is set, we can still default to using
|
|
85
143
|
// normal selection (i.e. base RN text) if the text doesn't need to be
|
package/lib/module/Text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","StyleSheet","Text","RNText","RNUITextViewChildNativeComponent","RNUITextViewNativeComponent","flattenStyles","jsx","_jsx","
|
|
1
|
+
{"version":3,"names":["React","Platform","StyleSheet","Text","RNText","RNUITextViewChildNativeComponent","RNUITextViewNativeComponent","resolvePressContext","flattenStyles","jsx","_jsx","TextAncestorContext","createContext","isAncestor","rootStyle","create","textDefaults","allowFontScaling","selectable","useTextAncestorContext","useContext","UITextViewChild","style","children","rest","highlightGroup","ancestorHighlightGroup","suppressHighlighting","ancestorSuppressHighlighting","pressRetentionOffset","ancestorPressRetentionOffset","onPress","ancestorOnPress","onLongPress","ancestorOnLongPress","ownHighlightGroup","useId","nativeOnPress","nativeOnLongPress","flattenedStyle","useMemo","Provider","value","undefined","Children","toArray","map","c","index","isValidElement","text","toString","pressRetentionOffsetTop","top","pressRetentionOffsetRight","right","pressRetentionOffsetBottom","bottom","pressRetentionOffsetLeft","left","UITextViewInner","props","uiTextView","UITextView","OS"],"sourceRoot":"../../src","sources":["Text.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,QAAQ,EACRC,U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C;AACF;AAEA,SAASY,eAAeA,CAACC,KAAsB,EAAE;EAC/C,MAAM;IAAChD;EAAU,CAAC,GAAGM,sBAAsB,CAAC,CAAC;;EAE7C;EACA;EACA;EACA,IAAI,CAAC,CAAC0C,KAAK,CAAC3C,UAAU,IAAI,CAAC2C,KAAK,CAACC,UAAU,KAAK,CAACjD,UAAU,EAAE;IAC3D,oBAAOH,IAAA,CAACN,MAAM;MAAA,GAAKyD;IAAK,CAAG,CAAC;EAC9B;EACA,oBAAOnD,IAAA,CAACW,eAAe;IAAA,GAAKwC;EAAK,CAAG,CAAC;AACvC;AAEA,OAAO,SAASE,UAAUA,CAACF,KAAsB,EAAE;EACjD,IAAI5D,QAAQ,CAAC+D,EAAE,KAAK,KAAK,EAAE;IACzB,oBAAOtD,IAAA,CAACN,MAAM;MAAA,GAAKyD;IAAK,CAAG,CAAC;EAC9B;EACA,oBAAOnD,IAAA,CAACkD,eAAe;IAAA,GAAKC;EAAK,CAAG,CAAC;AACvC","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function resolvePressContext(ownHighlightGroup, props, ancestor) {
|
|
4
|
+
const isPressable = props.onPress != null || props.onLongPress != null;
|
|
5
|
+
if (!isPressable) {
|
|
6
|
+
return ancestor;
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
// Keep handler capabilities in the identifier that native already uses to
|
|
10
|
+
// group highlighted fragments. This avoids a separate prop/state channel
|
|
11
|
+
// getting out of sync with the group and its event emitter.
|
|
12
|
+
highlightGroup: `${ownHighlightGroup}|${props.onPress ? 'p' : ''}${props.onLongPress ? 'l' : ''}`,
|
|
13
|
+
suppressHighlighting: props.suppressHighlighting === true,
|
|
14
|
+
pressRetentionOffset: props.pressRetentionOffset,
|
|
15
|
+
onPress: props.onPress,
|
|
16
|
+
onLongPress: props.onLongPress
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# 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":";;AAUA,OAAO,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":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../example/src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA8E9B,MAAM,CAAC,OAAO,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../example/src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA8E9B,MAAM,CAAC,OAAO,UAAU,GAAG,sBAuxB1B"}
|
|
@@ -21,6 +21,15 @@ interface NativeProps extends ViewProps {
|
|
|
21
21
|
textDecorationColor?: ColorValue;
|
|
22
22
|
textAlign?: CodegenTypes.WithDefault<TextAlign, 'auto'>;
|
|
23
23
|
shadowRadius?: CodegenTypes.WithDefault<CodegenTypes.Float, 0>;
|
|
24
|
+
/** Internal identifier used to highlight all fragments in a pressable Text. */
|
|
25
|
+
highlightGroup?: string;
|
|
26
|
+
/** Internal copy of Text's suppressHighlighting prop. */
|
|
27
|
+
suppressHighlighting?: boolean;
|
|
28
|
+
/** Internal expansion of the owning Text's press-retention rectangle. */
|
|
29
|
+
pressRetentionOffsetTop?: CodegenTypes.WithDefault<CodegenTypes.Float, 20>;
|
|
30
|
+
pressRetentionOffsetRight?: CodegenTypes.WithDefault<CodegenTypes.Float, 20>;
|
|
31
|
+
pressRetentionOffsetBottom?: CodegenTypes.WithDefault<CodegenTypes.Float, 30>;
|
|
32
|
+
pressRetentionOffsetLeft?: CodegenTypes.WithDefault<CodegenTypes.Float, 20>;
|
|
24
33
|
onPress?: CodegenTypes.BubblingEventHandler<TargetedEvent>;
|
|
25
34
|
onLongPress?: CodegenTypes.BubblingEventHandler<TargetedEvent>;
|
|
26
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RNUITextViewChildNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/RNUITextViewChildNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EAEf,MAAM,cAAc,CAAA;AAErB,UAAU,aAAa;IACrB,MAAM,EAAE,YAAY,CAAC,KAAK,CAAA;CAC3B;AAED,KAAK,kBAAkB,GAAG,MAAM,GAAG,WAAW,GAAG,cAAc,CAAA;AAE/D,KAAK,mBAAmB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEnE,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,MAAM,GACN,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,UAAU,GACV,OAAO,CAAA;AAEX,KAAK,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA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,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAC9D,+EAA+E;IAC/E,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,yDAAyD;IACzD,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,yEAAyE;IACzE,uBAAuB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IAC1E,yBAAyB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IAC5E,0BAA0B,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IAC7E,wBAAwB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IAC3E,OAAO,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAA;IAC1D,WAAW,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAA;CAC/D;;AAED,wBAEE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../src/Text.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,SAAS,EAEf,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../src/Text.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,SAAS,EAEf,MAAM,cAAc,CAAA;AAuBrB;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAC,CAAA;CAC1D,CAAA;AAED,KAAK,eAAe,GAAG,SAAS,GAAG;IACjC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAA;CAC1D,CAAA;AA6ID,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,+BAKhD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TextProps } from 'react-native';
|
|
2
|
+
export type PressContext = {
|
|
3
|
+
highlightGroup?: string;
|
|
4
|
+
suppressHighlighting?: boolean;
|
|
5
|
+
pressRetentionOffset?: TextProps['pressRetentionOffset'];
|
|
6
|
+
onPress?: TextProps['onPress'];
|
|
7
|
+
onLongPress?: TextProps['onLongPress'];
|
|
8
|
+
};
|
|
9
|
+
export declare function resolvePressContext(ownHighlightGroup: string, props: Pick<TextProps, 'onPress' | 'onLongPress' | 'pressRetentionOffset' | 'suppressHighlighting'>, ancestor: PressContext): PressContext;
|
|
10
|
+
//# sourceMappingURL=press.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"press.d.ts","sourceRoot":"","sources":["../../../../src/press.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAA;AAE3C,MAAM,MAAM,YAAY,GAAG;IACzB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,oBAAoB,CAAC,EAAE,SAAS,CAAC,sBAAsB,CAAC,CAAA;IACxD,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC9B,WAAW,CAAC,EAAE,SAAS,CAAC,aAAa,CAAC,CAAA;CACvC,CAAA;AAED,wBAAgB,mBAAmB,CACjC,iBAAiB,EAAE,MAAM,EACzB,KAAK,EAAE,IAAI,CACT,SAAS,EACT,SAAS,GAAG,aAAa,GAAG,sBAAsB,GAAG,sBAAsB,CAC5E,EACD,QAAQ,EAAE,YAAY,GACrB,YAAY,CAkBd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../example/src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA8E9B,MAAM,CAAC,OAAO,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../example/src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA8E9B,MAAM,CAAC,OAAO,UAAU,GAAG,sBAuxB1B"}
|
|
@@ -21,6 +21,15 @@ interface NativeProps extends ViewProps {
|
|
|
21
21
|
textDecorationColor?: ColorValue;
|
|
22
22
|
textAlign?: CodegenTypes.WithDefault<TextAlign, 'auto'>;
|
|
23
23
|
shadowRadius?: CodegenTypes.WithDefault<CodegenTypes.Float, 0>;
|
|
24
|
+
/** Internal identifier used to highlight all fragments in a pressable Text. */
|
|
25
|
+
highlightGroup?: string;
|
|
26
|
+
/** Internal copy of Text's suppressHighlighting prop. */
|
|
27
|
+
suppressHighlighting?: boolean;
|
|
28
|
+
/** Internal expansion of the owning Text's press-retention rectangle. */
|
|
29
|
+
pressRetentionOffsetTop?: CodegenTypes.WithDefault<CodegenTypes.Float, 20>;
|
|
30
|
+
pressRetentionOffsetRight?: CodegenTypes.WithDefault<CodegenTypes.Float, 20>;
|
|
31
|
+
pressRetentionOffsetBottom?: CodegenTypes.WithDefault<CodegenTypes.Float, 30>;
|
|
32
|
+
pressRetentionOffsetLeft?: CodegenTypes.WithDefault<CodegenTypes.Float, 20>;
|
|
24
33
|
onPress?: CodegenTypes.BubblingEventHandler<TargetedEvent>;
|
|
25
34
|
onLongPress?: CodegenTypes.BubblingEventHandler<TargetedEvent>;
|
|
26
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RNUITextViewChildNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/RN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|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../src/Text.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,SAAS,EAEf,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../src/Text.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,SAAS,EAEf,MAAM,cAAc,CAAA;AAuBrB;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAC,CAAA;CAC1D,CAAA;AAED,KAAK,eAAe,GAAG,SAAS,GAAG;IACjC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAA;CAC1D,CAAA;AA6ID,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,+BAKhD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TextProps } from 'react-native';
|
|
2
|
+
export type PressContext = {
|
|
3
|
+
highlightGroup?: string;
|
|
4
|
+
suppressHighlighting?: boolean;
|
|
5
|
+
pressRetentionOffset?: TextProps['pressRetentionOffset'];
|
|
6
|
+
onPress?: TextProps['onPress'];
|
|
7
|
+
onLongPress?: TextProps['onLongPress'];
|
|
8
|
+
};
|
|
9
|
+
export declare function resolvePressContext(ownHighlightGroup: string, props: Pick<TextProps, 'onPress' | 'onLongPress' | 'pressRetentionOffset' | 'suppressHighlighting'>, ancestor: PressContext): PressContext;
|
|
10
|
+
//# sourceMappingURL=press.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"press.d.ts","sourceRoot":"","sources":["../../../../src/press.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAA;AAE3C,MAAM,MAAM,YAAY,GAAG;IACzB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,oBAAoB,CAAC,EAAE,SAAS,CAAC,sBAAsB,CAAC,CAAA;IACxD,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC9B,WAAW,CAAC,EAAE,SAAS,CAAC,aAAa,CAAC,CAAA;CACvC,CAAA;AAED,wBAAgB,mBAAmB,CACjC,iBAAiB,EAAE,MAAM,EACzB,KAAK,EAAE,IAAI,CACT,SAAS,EACT,SAAS,GAAG,aAAa,GAAG,sBAAsB,GAAG,sBAAsB,CAC5E,EACD,QAAQ,EAAE,YAAY,GACrB,YAAY,CAkBd"}
|
package/package.json
CHANGED
|
@@ -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
|
}
|
package/src/Text.tsx
CHANGED
|
@@ -8,12 +8,18 @@ import {
|
|
|
8
8
|
} from 'react-native'
|
|
9
9
|
import RNUITextViewChildNativeComponent from './RNUITextViewChildNativeComponent'
|
|
10
10
|
import RNUITextViewNativeComponent from './RNUITextViewNativeComponent'
|
|
11
|
+
import {resolvePressContext, type PressContext} from './press'
|
|
11
12
|
import {flattenStyles} from './util'
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
type TextAncestorContextValue = PressContext & {
|
|
15
|
+
isAncestor: boolean
|
|
16
|
+
rootStyle: ViewStyle
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const TextAncestorContext = React.createContext<TextAncestorContextValue>({
|
|
20
|
+
isAncestor: false,
|
|
21
|
+
rootStyle: StyleSheet.create({}),
|
|
22
|
+
})
|
|
17
23
|
|
|
18
24
|
const textDefaults: TextProps = {
|
|
19
25
|
allowFontScaling: true,
|
|
@@ -42,7 +48,38 @@ type UITextViewProps = TextProps & {
|
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
function UITextViewChild({style, children, ...rest}: UITextViewProps) {
|
|
45
|
-
const
|
|
51
|
+
const {
|
|
52
|
+
isAncestor,
|
|
53
|
+
rootStyle,
|
|
54
|
+
highlightGroup: ancestorHighlightGroup,
|
|
55
|
+
suppressHighlighting: ancestorSuppressHighlighting,
|
|
56
|
+
pressRetentionOffset: ancestorPressRetentionOffset,
|
|
57
|
+
onPress: ancestorOnPress,
|
|
58
|
+
onLongPress: ancestorOnLongPress,
|
|
59
|
+
} = useTextAncestorContext()
|
|
60
|
+
const ownHighlightGroup = React.useId()
|
|
61
|
+
const {
|
|
62
|
+
highlightGroup,
|
|
63
|
+
suppressHighlighting,
|
|
64
|
+
pressRetentionOffset,
|
|
65
|
+
onPress,
|
|
66
|
+
onLongPress,
|
|
67
|
+
} = resolvePressContext(ownHighlightGroup, rest, {
|
|
68
|
+
highlightGroup: ancestorHighlightGroup,
|
|
69
|
+
suppressHighlighting: ancestorSuppressHighlighting,
|
|
70
|
+
pressRetentionOffset: ancestorPressRetentionOffset,
|
|
71
|
+
onPress: ancestorOnPress,
|
|
72
|
+
onLongPress: ancestorOnLongPress,
|
|
73
|
+
})
|
|
74
|
+
// The native event currently contains only `target`, while TextProps types
|
|
75
|
+
// these callbacks as full gesture events. Preserve the existing public type
|
|
76
|
+
// and adapt it only at the private Codegen boundary.
|
|
77
|
+
const nativeOnPress = onPress as React.ComponentProps<
|
|
78
|
+
typeof RNUITextViewChildNativeComponent
|
|
79
|
+
>['onPress']
|
|
80
|
+
const nativeOnLongPress = onLongPress as React.ComponentProps<
|
|
81
|
+
typeof RNUITextViewChildNativeComponent
|
|
82
|
+
>['onLongPress']
|
|
46
83
|
|
|
47
84
|
// Flatten the styles, and apply the root styles when needed
|
|
48
85
|
const flattenedStyle = React.useMemo(
|
|
@@ -52,7 +89,16 @@ function UITextViewChild({style, children, ...rest}: UITextViewProps) {
|
|
|
52
89
|
|
|
53
90
|
if (!isAncestor) {
|
|
54
91
|
return (
|
|
55
|
-
<TextAncestorContext.Provider
|
|
92
|
+
<TextAncestorContext.Provider
|
|
93
|
+
value={{
|
|
94
|
+
isAncestor: true,
|
|
95
|
+
rootStyle: flattenedStyle,
|
|
96
|
+
highlightGroup,
|
|
97
|
+
suppressHighlighting,
|
|
98
|
+
pressRetentionOffset,
|
|
99
|
+
onPress,
|
|
100
|
+
onLongPress,
|
|
101
|
+
}}>
|
|
56
102
|
<RNUITextViewNativeComponent
|
|
57
103
|
{...textDefaults}
|
|
58
104
|
{...rest}
|
|
@@ -66,12 +112,19 @@ function UITextViewChild({style, children, ...rest}: UITextViewProps) {
|
|
|
66
112
|
return c
|
|
67
113
|
} else if (typeof c === 'string' || typeof c === 'number') {
|
|
68
114
|
return (
|
|
69
|
-
// @ts-expect-error @TODO fix this type
|
|
70
115
|
<RNUITextViewChildNativeComponent
|
|
71
116
|
key={index}
|
|
72
117
|
style={flattenedStyle}
|
|
73
118
|
text={c.toString()}
|
|
74
119
|
{...rest}
|
|
120
|
+
highlightGroup={highlightGroup}
|
|
121
|
+
suppressHighlighting={suppressHighlighting}
|
|
122
|
+
pressRetentionOffsetTop={pressRetentionOffset?.top}
|
|
123
|
+
pressRetentionOffsetRight={pressRetentionOffset?.right}
|
|
124
|
+
pressRetentionOffsetBottom={pressRetentionOffset?.bottom}
|
|
125
|
+
pressRetentionOffsetLeft={pressRetentionOffset?.left}
|
|
126
|
+
onPress={nativeOnPress}
|
|
127
|
+
onLongPress={nativeOnLongPress}
|
|
75
128
|
/>
|
|
76
129
|
)
|
|
77
130
|
}
|
|
@@ -82,31 +135,47 @@ function UITextViewChild({style, children, ...rest}: UITextViewProps) {
|
|
|
82
135
|
)
|
|
83
136
|
} else {
|
|
84
137
|
return (
|
|
85
|
-
|
|
138
|
+
<TextAncestorContext.Provider
|
|
139
|
+
value={{
|
|
140
|
+
isAncestor: true,
|
|
141
|
+
rootStyle: flattenedStyle,
|
|
142
|
+
highlightGroup,
|
|
143
|
+
suppressHighlighting,
|
|
144
|
+
pressRetentionOffset,
|
|
145
|
+
onPress,
|
|
146
|
+
onLongPress,
|
|
147
|
+
}}>
|
|
86
148
|
{React.Children.toArray(children).map((c, index) => {
|
|
87
149
|
if (React.isValidElement(c)) {
|
|
88
150
|
return c
|
|
89
151
|
} else if (typeof c === 'string' || typeof c === 'number') {
|
|
90
152
|
return (
|
|
91
|
-
// @ts-expect-error @TODO fix this type
|
|
92
153
|
<RNUITextViewChildNativeComponent
|
|
93
154
|
key={index}
|
|
94
155
|
style={flattenedStyle}
|
|
95
156
|
text={c.toString()}
|
|
96
157
|
{...rest}
|
|
158
|
+
highlightGroup={highlightGroup}
|
|
159
|
+
suppressHighlighting={suppressHighlighting}
|
|
160
|
+
pressRetentionOffsetTop={pressRetentionOffset?.top}
|
|
161
|
+
pressRetentionOffsetRight={pressRetentionOffset?.right}
|
|
162
|
+
pressRetentionOffsetBottom={pressRetentionOffset?.bottom}
|
|
163
|
+
pressRetentionOffsetLeft={pressRetentionOffset?.left}
|
|
164
|
+
onPress={nativeOnPress}
|
|
165
|
+
onLongPress={nativeOnLongPress}
|
|
97
166
|
/>
|
|
98
167
|
)
|
|
99
168
|
}
|
|
100
169
|
|
|
101
170
|
return null
|
|
102
171
|
})}
|
|
103
|
-
|
|
172
|
+
</TextAncestorContext.Provider>
|
|
104
173
|
)
|
|
105
174
|
}
|
|
106
175
|
}
|
|
107
176
|
|
|
108
177
|
function UITextViewInner(props: UITextViewProps) {
|
|
109
|
-
const
|
|
178
|
+
const {isAncestor} = useTextAncestorContext()
|
|
110
179
|
|
|
111
180
|
// Even if the uiTextView prop is set, we can still default to using
|
|
112
181
|
// normal selection (i.e. base RN text) if the text doesn't need to be
|
package/src/press.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type {TextProps} from 'react-native'
|
|
2
|
+
|
|
3
|
+
export type PressContext = {
|
|
4
|
+
highlightGroup?: string
|
|
5
|
+
suppressHighlighting?: boolean
|
|
6
|
+
pressRetentionOffset?: TextProps['pressRetentionOffset']
|
|
7
|
+
onPress?: TextProps['onPress']
|
|
8
|
+
onLongPress?: TextProps['onLongPress']
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function resolvePressContext(
|
|
12
|
+
ownHighlightGroup: string,
|
|
13
|
+
props: Pick<
|
|
14
|
+
TextProps,
|
|
15
|
+
'onPress' | 'onLongPress' | 'pressRetentionOffset' | 'suppressHighlighting'
|
|
16
|
+
>,
|
|
17
|
+
ancestor: PressContext,
|
|
18
|
+
): PressContext {
|
|
19
|
+
const isPressable = props.onPress != null || props.onLongPress != null
|
|
20
|
+
if (!isPressable) {
|
|
21
|
+
return ancestor
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
// Keep handler capabilities in the identifier that native already uses to
|
|
26
|
+
// group highlighted fragments. This avoids a separate prop/state channel
|
|
27
|
+
// getting out of sync with the group and its event emitter.
|
|
28
|
+
highlightGroup: `${ownHighlightGroup}|${props.onPress ? 'p' : ''}${
|
|
29
|
+
props.onLongPress ? 'l' : ''
|
|
30
|
+
}`,
|
|
31
|
+
suppressHighlighting: props.suppressHighlighting === true,
|
|
32
|
+
pressRetentionOffset: props.pressRetentionOffset,
|
|
33
|
+
onPress: props.onPress,
|
|
34
|
+
onLongPress: props.onLongPress,
|
|
35
|
+
}
|
|
36
|
+
}
|