@onekeyfe/react-native-text 3.0.110 → 3.0.111

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.
@@ -90,43 +90,44 @@ const PressableText = /*#__PURE__*/forwardRef(function PressableText({
90
90
  ref: ref
91
91
  });
92
92
  });
93
- function TextImpl({
94
- accessible,
95
- accessibilityLabel,
96
- accessibilityRole,
97
- accessibilityState,
98
- allowFontScaling,
99
- 'aria-busy': ariaBusy,
100
- 'aria-checked': ariaChecked,
101
- 'aria-disabled': ariaDisabled,
102
- 'aria-expanded': ariaExpanded,
103
- 'aria-hidden': ariaHidden,
104
- 'aria-label': ariaLabel,
105
- 'aria-selected': ariaSelected,
106
- children,
107
- ellipsizeMode,
108
- disabled,
109
- id,
110
- nativeID,
111
- numberOfLines,
112
- onLongPress,
113
- onPress,
114
- onPressIn,
115
- onPressOut,
116
- onResponderGrant,
117
- onResponderMove,
118
- onResponderRelease,
119
- onResponderTerminate,
120
- onResponderTerminationRequest,
121
- onStartShouldSetResponder,
122
- pressRetentionOffset,
123
- role,
124
- selectable,
125
- selectionColor,
126
- suppressHighlighting,
127
- style,
128
- ...restProps
129
- }, forwardedRef) {
93
+ function TextImpl(props, forwardedRef) {
94
+ const {
95
+ accessible,
96
+ accessibilityLabel,
97
+ accessibilityRole,
98
+ accessibilityState,
99
+ allowFontScaling,
100
+ 'aria-busy': ariaBusy,
101
+ 'aria-checked': ariaChecked,
102
+ 'aria-disabled': ariaDisabled,
103
+ 'aria-expanded': ariaExpanded,
104
+ 'aria-hidden': ariaHidden,
105
+ 'aria-label': ariaLabel,
106
+ 'aria-selected': ariaSelected,
107
+ children,
108
+ ellipsizeMode,
109
+ disabled,
110
+ id,
111
+ nativeID,
112
+ numberOfLines,
113
+ onLongPress,
114
+ onPress,
115
+ onPressIn,
116
+ onPressOut,
117
+ onResponderGrant,
118
+ onResponderMove,
119
+ onResponderRelease,
120
+ onResponderTerminate,
121
+ onResponderTerminationRequest,
122
+ onStartShouldSetResponder,
123
+ pressRetentionOffset,
124
+ role,
125
+ selectable,
126
+ selectionColor,
127
+ suppressHighlighting,
128
+ style,
129
+ ...restProps
130
+ } = props;
130
131
  const hasTextAncestor = useContext(TextAncestorContext);
131
132
  if (hasTextAncestor) {
132
133
  return /*#__PURE__*/_jsx(ReactNativeText, {
@@ -243,6 +244,12 @@ function TextImpl({
243
244
  processedStyle = [processedStyle, overrides];
244
245
  }
245
246
  }
247
+ if (processedSelectable === true && ReactNativeFeatureFlags.enablePreparedTextLayout()) {
248
+ return /*#__PURE__*/_jsx(ReactNativeText, {
249
+ ...props,
250
+ ref: forwardedRef
251
+ });
252
+ }
246
253
  if (ReactNativeFeatureFlags.defaultTextToOverflowHidden()) {
247
254
  processedStyle = [styles.default, processedStyle];
248
255
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-text",
3
- "version": "3.0.110",
3
+ "version": "3.0.111",
4
4
  "description": "Opt-in native text rendering for React Native",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/module/index.js",
@@ -178,8 +178,8 @@ const PressableText = forwardRef<TextForwardRef, PressableTextProps>(
178
178
  }
179
179
  );
180
180
 
181
- function TextImpl(
182
- {
181
+ function TextImpl(props: TextProps, forwardedRef: Ref<TextForwardRef>) {
182
+ const {
183
183
  accessible,
184
184
  accessibilityLabel,
185
185
  accessibilityRole,
@@ -215,9 +215,7 @@ function TextImpl(
215
215
  suppressHighlighting,
216
216
  style,
217
217
  ...restProps
218
- }: TextProps,
219
- forwardedRef: Ref<TextForwardRef>
220
- ) {
218
+ } = props;
221
219
  const hasTextAncestor = useContext(TextAncestorContext);
222
220
  if (hasTextAncestor) {
223
221
  return (
@@ -369,6 +367,13 @@ function TextImpl(
369
367
  }
370
368
  }
371
369
 
370
+ if (
371
+ processedSelectable === true &&
372
+ ReactNativeFeatureFlags.enablePreparedTextLayout()
373
+ ) {
374
+ return <ReactNativeText {...props} ref={forwardedRef} />;
375
+ }
376
+
372
377
  if (ReactNativeFeatureFlags.defaultTextToOverflowHidden()) {
373
378
  processedStyle = [styles.default, processedStyle];
374
379
  }
@@ -14,6 +14,7 @@ declare module 'react-native/Libraries/Pressability/PressabilityDebug' {
14
14
  }
15
15
 
16
16
  declare module 'react-native/src/private/featureflags/ReactNativeFeatureFlags' {
17
+ export function enablePreparedTextLayout(): boolean;
17
18
  export function defaultTextToOverflowHidden(): boolean;
18
19
  }
19
20