@bsky.app/react-native-uitextview 2.3.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 (103) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +188 -0
  3. package/android/generated/android/app/build/generated/source/codegen/jni/CMakeLists.txt +28 -0
  4. package/android/generated/android/app/build/generated/source/codegen/jni/RNUITextViewSpec-generated.cpp +22 -0
  5. package/android/generated/android/app/build/generated/source/codegen/jni/RNUITextViewSpec.h +24 -0
  6. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.cpp +23 -0
  7. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.h +25 -0
  8. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/EventEmitters.cpp +61 -0
  9. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/EventEmitters.h +49 -0
  10. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/Props.cpp +151 -0
  11. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/Props.h +236 -0
  12. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/RNUITextViewSpecJSI.h +19 -0
  13. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/ShadowNodes.cpp +18 -0
  14. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/ShadowNodes.h +43 -0
  15. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/States.cpp +16 -0
  16. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/States.h +22 -0
  17. package/ios/RNUITextView.h +13 -0
  18. package/ios/RNUITextView.mm +338 -0
  19. package/ios/RNUITextViewChild.h +24 -0
  20. package/ios/RNUITextViewChild.mm +72 -0
  21. package/ios/RNUITextViewChildComponentDescriptor.h +13 -0
  22. package/ios/RNUITextViewChildShadowNode.cpp +6 -0
  23. package/ios/RNUITextViewChildShadowNode.h +16 -0
  24. package/ios/RNUITextViewComponentDescriptor.h +13 -0
  25. package/ios/RNUITextViewManager.mm +36 -0
  26. package/ios/RNUITextViewShadowNode.cpp +139 -0
  27. package/ios/RNUITextViewShadowNode.h +48 -0
  28. package/ios/generated/build/generated/ios/ReactCodegen/RNUITextViewSpec/RNUITextViewSpec-generated.mm +16 -0
  29. package/ios/generated/build/generated/ios/ReactCodegen/RNUITextViewSpec/RNUITextViewSpec.h +38 -0
  30. package/ios/generated/build/generated/ios/ReactCodegen/RNUITextViewSpecJSI.h +19 -0
  31. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.cpp +23 -0
  32. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.h +25 -0
  33. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/EventEmitters.cpp +61 -0
  34. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/EventEmitters.h +49 -0
  35. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/Props.cpp +151 -0
  36. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/Props.h +236 -0
  37. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/RCTComponentViewHelpers.h +24 -0
  38. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/ShadowNodes.cpp +18 -0
  39. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/ShadowNodes.h +43 -0
  40. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/States.cpp +16 -0
  41. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/States.h +22 -0
  42. package/lib/commonjs/RNUITextViewChildNativeComponent.ts +49 -0
  43. package/lib/commonjs/RNUITextViewNativeComponent.ts +53 -0
  44. package/lib/commonjs/Text.js +111 -0
  45. package/lib/commonjs/Text.js.map +1 -0
  46. package/lib/commonjs/Text.web.js +23 -0
  47. package/lib/commonjs/Text.web.js.map +1 -0
  48. package/lib/commonjs/index.js +17 -0
  49. package/lib/commonjs/index.js.map +1 -0
  50. package/lib/commonjs/package.json +1 -0
  51. package/lib/commonjs/util.js +66 -0
  52. package/lib/commonjs/util.js.map +1 -0
  53. package/lib/module/RNUITextViewChildNativeComponent.ts +49 -0
  54. package/lib/module/RNUITextViewNativeComponent.ts +53 -0
  55. package/lib/module/Text.js +106 -0
  56. package/lib/module/Text.js.map +1 -0
  57. package/lib/module/Text.web.js +19 -0
  58. package/lib/module/Text.web.js.map +1 -0
  59. package/lib/module/index.js +4 -0
  60. package/lib/module/index.js.map +1 -0
  61. package/lib/module/package.json +1 -0
  62. package/lib/module/util.js +62 -0
  63. package/lib/module/util.js.map +1 -0
  64. package/lib/typescript/commonjs/example/src/App.d.ts +3 -0
  65. package/lib/typescript/commonjs/example/src/App.d.ts.map +1 -0
  66. package/lib/typescript/commonjs/package.json +1 -0
  67. package/lib/typescript/commonjs/src/RNUITextViewChildNativeComponent.d.ts +29 -0
  68. package/lib/typescript/commonjs/src/RNUITextViewChildNativeComponent.d.ts.map +1 -0
  69. package/lib/typescript/commonjs/src/RNUITextViewNativeComponent.d.ts +43 -0
  70. package/lib/typescript/commonjs/src/RNUITextViewNativeComponent.d.ts.map +1 -0
  71. package/lib/typescript/commonjs/src/Text.d.ts +25 -0
  72. package/lib/typescript/commonjs/src/Text.d.ts.map +1 -0
  73. package/lib/typescript/commonjs/src/Text.web.d.ts +19 -0
  74. package/lib/typescript/commonjs/src/Text.web.d.ts.map +1 -0
  75. package/lib/typescript/commonjs/src/index.d.ts +2 -0
  76. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  77. package/lib/typescript/commonjs/src/util.d.ts +163 -0
  78. package/lib/typescript/commonjs/src/util.d.ts.map +1 -0
  79. package/lib/typescript/module/example/src/App.d.ts +3 -0
  80. package/lib/typescript/module/example/src/App.d.ts.map +1 -0
  81. package/lib/typescript/module/package.json +1 -0
  82. package/lib/typescript/module/src/RNUITextViewChildNativeComponent.d.ts +29 -0
  83. package/lib/typescript/module/src/RNUITextViewChildNativeComponent.d.ts.map +1 -0
  84. package/lib/typescript/module/src/RNUITextViewNativeComponent.d.ts +43 -0
  85. package/lib/typescript/module/src/RNUITextViewNativeComponent.d.ts.map +1 -0
  86. package/lib/typescript/module/src/Text.d.ts +25 -0
  87. package/lib/typescript/module/src/Text.d.ts.map +1 -0
  88. package/lib/typescript/module/src/Text.web.d.ts +19 -0
  89. package/lib/typescript/module/src/Text.web.d.ts.map +1 -0
  90. package/lib/typescript/module/src/index.d.ts +2 -0
  91. package/lib/typescript/module/src/index.d.ts.map +1 -0
  92. package/lib/typescript/module/src/util.d.ts +163 -0
  93. package/lib/typescript/module/src/util.d.ts.map +1 -0
  94. package/package.json +185 -0
  95. package/react-native-uitextview.podspec +34 -0
  96. package/react-native.config.js +28 -0
  97. package/scripts/ensure-rnc-cli-executable.js +19 -0
  98. package/src/RNUITextViewChildNativeComponent.ts +49 -0
  99. package/src/RNUITextViewNativeComponent.ts +53 -0
  100. package/src/Text.tsx +125 -0
  101. package/src/Text.web.tsx +22 -0
  102. package/src/index.tsx +1 -0
  103. package/src/util.ts +67 -0
@@ -0,0 +1,24 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateComponentHObjCpp.js
8
+ */
9
+
10
+ #import <Foundation/Foundation.h>
11
+ #import <React/RCTDefines.h>
12
+ #import <React/RCTLog.h>
13
+
14
+ NS_ASSUME_NONNULL_BEGIN
15
+
16
+ @protocol RCTRNUITextViewChildViewProtocol <NSObject>
17
+
18
+ @end
19
+
20
+ @protocol RCTRNUITextViewViewProtocol <NSObject>
21
+
22
+ @end
23
+
24
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,18 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateShadowNodeCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/RNUITextViewSpec/ShadowNodes.h>
12
+
13
+ namespace facebook::react {
14
+
15
+ extern const char RNUITextViewChildComponentName[] = "RNUITextViewChild";
16
+ extern const char RNUITextViewComponentName[] = "RNUITextView";
17
+
18
+ } // namespace facebook::react
@@ -0,0 +1,43 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateShadowNodeH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <react/renderer/components/RNUITextViewSpec/EventEmitters.h>
14
+ #include <react/renderer/components/RNUITextViewSpec/Props.h>
15
+ #include <react/renderer/components/RNUITextViewSpec/States.h>
16
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
17
+ #include <jsi/jsi.h>
18
+
19
+ namespace facebook::react {
20
+
21
+ JSI_EXPORT extern const char RNUITextViewChildComponentName[];
22
+
23
+ /*
24
+ * `ShadowNode` for <RNUITextViewChild> component.
25
+ */
26
+ using RNUITextViewChildShadowNode = ConcreteViewShadowNode<
27
+ RNUITextViewChildComponentName,
28
+ RNUITextViewChildProps,
29
+ RNUITextViewChildEventEmitter,
30
+ RNUITextViewChildState>;
31
+
32
+ JSI_EXPORT extern const char RNUITextViewComponentName[];
33
+
34
+ /*
35
+ * `ShadowNode` for <RNUITextView> component.
36
+ */
37
+ using RNUITextViewShadowNode = ConcreteViewShadowNode<
38
+ RNUITextViewComponentName,
39
+ RNUITextViewProps,
40
+ RNUITextViewEventEmitter,
41
+ RNUITextViewState>;
42
+
43
+ } // namespace facebook::react
@@ -0,0 +1,16 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateStateCpp.js
9
+ */
10
+ #include <react/renderer/components/RNUITextViewSpec/States.h>
11
+
12
+ namespace facebook::react {
13
+
14
+
15
+
16
+ } // namespace facebook::react
@@ -0,0 +1,22 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateStateH.js
8
+ */
9
+ #pragma once
10
+
11
+ #include <react/renderer/core/StateData.h>
12
+ #ifdef RN_SERIALIZABLE_STATE
13
+ #include <folly/dynamic.h>
14
+ #endif
15
+
16
+ namespace facebook::react {
17
+
18
+ using RNUITextViewChildState = StateData;
19
+
20
+ using RNUITextViewState = StateData;
21
+
22
+ } // namespace facebook::react
@@ -0,0 +1,49 @@
1
+ import {
2
+ type CodegenTypes,
3
+ type ColorValue,
4
+ type ViewProps,
5
+ codegenNativeComponent,
6
+ } from 'react-native'
7
+
8
+ interface TargetedEvent {
9
+ target: CodegenTypes.Int32
10
+ }
11
+
12
+ type TextDecorationLine = 'none' | 'underline' | 'line-through'
13
+
14
+ type TextDecorationStyle = 'solid' | 'double' | 'dotted' | 'dashed'
15
+
16
+ export type NativeFontWeight =
17
+ | 'normal'
18
+ | 'bold'
19
+ | 'ultraLight'
20
+ | 'light'
21
+ | 'medium'
22
+ | 'semibold'
23
+ | 'heavy'
24
+
25
+ type FontStyle = 'normal' | 'italic'
26
+
27
+ type TextAlign = 'auto' | 'left' | 'right' | 'center' | 'justify'
28
+
29
+ interface NativeProps extends ViewProps {
30
+ text: string
31
+ color?: ColorValue
32
+ fontSize?: CodegenTypes.Float
33
+ fontStyle?: CodegenTypes.WithDefault<FontStyle, 'normal'>
34
+ fontWeight?: CodegenTypes.WithDefault<NativeFontWeight, 'normal'>
35
+ fontFamily?: string
36
+ letterSpacing?: CodegenTypes.Float
37
+ lineHeight?: CodegenTypes.Float
38
+ textDecorationLine?: CodegenTypes.WithDefault<TextDecorationLine, 'none'>
39
+ textDecorationStyle?: CodegenTypes.WithDefault<TextDecorationStyle, 'solid'>
40
+ textDecorationColor?: ColorValue
41
+ textAlign?: CodegenTypes.WithDefault<TextAlign, 'auto'>
42
+ shadowRadius?: CodegenTypes.WithDefault<CodegenTypes.Float, 0>
43
+ onPress?: CodegenTypes.BubblingEventHandler<TargetedEvent>
44
+ onLongPress?: CodegenTypes.BubblingEventHandler<TargetedEvent>
45
+ }
46
+
47
+ export default codegenNativeComponent<NativeProps>('RNUITextViewChild', {
48
+ excludedPlatforms: ['android'],
49
+ })
@@ -0,0 +1,53 @@
1
+ import {
2
+ type CodegenTypes,
3
+ type ViewProps,
4
+ codegenNativeComponent,
5
+ } from 'react-native'
6
+
7
+ interface TargetedEvent {
8
+ target: CodegenTypes.Int32
9
+ }
10
+
11
+ interface TextLayoutEvent extends TargetedEvent {
12
+ lines: string[]
13
+ }
14
+
15
+ /**
16
+ * Event fired when text selection changes in the UITextView.
17
+ * @property target - The view tag identifier
18
+ * @property start - The start index of the selected range (0-based)
19
+ * @property end - The end index of the selected range (0-based, exclusive)
20
+ */
21
+ interface SelectionChangeEvent extends TargetedEvent {
22
+ start: CodegenTypes.Int32
23
+ end: CodegenTypes.Int32
24
+ }
25
+
26
+ type EllipsizeMode = 'head' | 'middle' | 'tail' | 'clip'
27
+
28
+ interface NativeProps extends ViewProps {
29
+ numberOfLines?: CodegenTypes.Int32
30
+ allowFontScaling?: CodegenTypes.WithDefault<boolean, true>
31
+ ellipsizeMode?: CodegenTypes.WithDefault<EllipsizeMode, 'tail'>
32
+ selectable?: boolean
33
+ onTextLayout?: CodegenTypes.BubblingEventHandler<TextLayoutEvent>
34
+ /**
35
+ * Callback fired when the text selection changes.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * <UITextView
40
+ * onSelectionChange={(event) => {
41
+ * console.log('Selection:', event.nativeEvent.start, event.nativeEvent.end);
42
+ * }}
43
+ * >
44
+ * Selectable text
45
+ * </UITextView>
46
+ * ```
47
+ */
48
+ onSelectionChange?: CodegenTypes.BubblingEventHandler<SelectionChangeEvent>
49
+ }
50
+
51
+ export default codegenNativeComponent<NativeProps>('RNUITextView', {
52
+ excludedPlatforms: ['android'],
53
+ })
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.UITextView = UITextView;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _RNUITextViewChildNativeComponent = _interopRequireDefault(require("./RNUITextViewChildNativeComponent"));
10
+ var _RNUITextViewNativeComponent = _interopRequireDefault(require("./RNUITextViewNativeComponent"));
11
+ var _util = require("./util.js");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ const TextAncestorContext = /*#__PURE__*/_react.default.createContext([false, _reactNative.StyleSheet.create({})]);
15
+ const textDefaults = {
16
+ allowFontScaling: true,
17
+ selectable: true
18
+ };
19
+ const useTextAncestorContext = () => _react.default.useContext(TextAncestorContext);
20
+
21
+ /**
22
+ * Event fired by `onSelectionChange`. `start`/`end` are 0-based UTF-16 indices
23
+ * into the rendered string. `start === end` means the selection was cleared.
24
+ */
25
+
26
+ function UITextViewChild({
27
+ style,
28
+ children,
29
+ ...rest
30
+ }) {
31
+ const [isAncestor, rootStyle] = useTextAncestorContext();
32
+
33
+ // Flatten the styles, and apply the root styles when needed
34
+ const flattenedStyle = _react.default.useMemo(() => (0, _util.flattenStyles)(rootStyle, style), [rootStyle, style]);
35
+ if (!isAncestor) {
36
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextAncestorContext.Provider, {
37
+ value: [true, flattenedStyle],
38
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RNUITextViewNativeComponent.default, {
39
+ ...textDefaults,
40
+ ...rest,
41
+ // ellipsizeMode={rest.ellipsizeMode ?? rest.lineBreakMode ?? 'tail'}
42
+ style: [flattenedStyle]
43
+ // @ts-expect-error Weirdness
44
+ ,
45
+ onPress: undefined,
46
+ onLongPress: undefined,
47
+ children: _react.default.Children.toArray(children).map((c, index) => {
48
+ if (/*#__PURE__*/_react.default.isValidElement(c)) {
49
+ return c;
50
+ } 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
+ );
60
+ }
61
+ return null;
62
+ })
63
+ })
64
+ });
65
+ } else {
66
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
67
+ children: _react.default.Children.toArray(children).map((c, index) => {
68
+ if (/*#__PURE__*/_react.default.isValidElement(c)) {
69
+ return c;
70
+ } 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
+ );
80
+ }
81
+ return null;
82
+ })
83
+ });
84
+ }
85
+ }
86
+ function UITextViewInner(props) {
87
+ const [isAncestor] = useTextAncestorContext();
88
+
89
+ // Even if the uiTextView prop is set, we can still default to using
90
+ // normal selection (i.e. base RN text) if the text doesn't need to be
91
+ // selectable
92
+ if ((!props.selectable || !props.uiTextView) && !isAncestor) {
93
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
94
+ ...props
95
+ });
96
+ }
97
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(UITextViewChild, {
98
+ ...props
99
+ });
100
+ }
101
+ function UITextView(props) {
102
+ if (_reactNative.Platform.OS !== 'ios') {
103
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
104
+ ...props
105
+ });
106
+ }
107
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(UITextViewInner, {
108
+ ...props
109
+ });
110
+ }
111
+ //# sourceMappingURL=Text.js.map
@@ -0,0 +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,C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3B,YAAA,CAAA6C,IAAM;MAAA,GAAKF;IAAK,CAAG,CAAC;EAC9B;EACA,oBAAO,IAAAvC,WAAA,CAAAuB,GAAA,EAACT,eAAe;IAAA,GAAKyB;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":[]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.UITextView = UITextView;
7
+ var _reactNative = require("react-native");
8
+ var _jsxRuntime = require("react/jsx-runtime");
9
+ /**
10
+ * Event fired by `onSelectionChange`. This event is only available when using
11
+ * the native UITextView implementation on iOS.
12
+ */
13
+
14
+ function UITextView({
15
+ uiTextView: _uiTextView,
16
+ onSelectionChange: _onSelectionChange,
17
+ ...props
18
+ }) {
19
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
20
+ ...props
21
+ });
22
+ }
23
+ //# sourceMappingURL=Text.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_jsxRuntime","UITextView","uiTextView","_uiTextView","onSelectionChange","_onSelectionChange","props","jsx","Text"],"sourceRoot":"../../src","sources":["Text.web.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAA2D,IAAAC,WAAA,GAAAD,OAAA;AAE3D;AACA;AACA;AACA;;AAUO,SAASE,UAAUA,CAAC;EACzBC,UAAU,EAAEC,WAAW;EACvBC,iBAAiB,EAAEC,kBAAkB;EACrC,GAAGC;AACY,CAAC,EAAE;EAClB,oBAAO,IAAAN,WAAA,CAAAO,GAAA,EAACT,YAAA,CAAAU,IAAM;IAAA,GAAKF;EAAK,CAAG,CAAC;AAC9B","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _Text = require("./Text");
7
+ Object.keys(_Text).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _Text[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _Text[key];
14
+ }
15
+ });
16
+ });
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_Text","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.flattenStyles = flattenStyles;
7
+ var _reactNative = require("react-native");
8
+ function flattenStyles(rootStyle, style) {
9
+ const flattenedStyle = _reactNative.StyleSheet.flatten([rootStyle, style]);
10
+ return {
11
+ ...flattenedStyle,
12
+ fontWeight: fontWeightToNativeProp(flattenedStyle.fontWeight ?? 'normal'),
13
+ backgroundColor: flattenedStyle.backgroundColor ? flattenedStyle.backgroundColor : 'transparent',
14
+ shadowOffset: flattenedStyle.shadowOffset ? flattenedStyle.shadowOffset : {
15
+ width: 0,
16
+ height: 0
17
+ }
18
+ };
19
+ }
20
+
21
+ // Codegen doesn't like using integer values for enums (c++ L) so we'll conver them to the proper native prop
22
+ // value before returning flattened styles.
23
+ function fontWeightToNativeProp(fontWeight) {
24
+ switch (fontWeight) {
25
+ case 'normal':
26
+ return 'normal';
27
+ case 'bold':
28
+ return 'bold';
29
+ case 100:
30
+ case '100':
31
+ case 'ultralight':
32
+ return 'ultraLight';
33
+ case 200:
34
+ case '200':
35
+ return 'ultraLight';
36
+ case 300:
37
+ case '300':
38
+ case 'light':
39
+ return 'light';
40
+ case 400:
41
+ case '400':
42
+ case 'regular':
43
+ return 'normal';
44
+ case 500:
45
+ case '500':
46
+ case 'medium':
47
+ return 'medium';
48
+ case 600:
49
+ case '600':
50
+ case 'semibold':
51
+ return 'semibold';
52
+ case 700:
53
+ case '700':
54
+ return 'semibold';
55
+ case 800:
56
+ case '800':
57
+ return 'bold';
58
+ case 900:
59
+ case '900':
60
+ case 'heavy':
61
+ return 'heavy';
62
+ default:
63
+ return 'normal';
64
+ }
65
+ }
66
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","flattenStyles","rootStyle","style","flattenedStyle","StyleSheet","flatten","fontWeight","fontWeightToNativeProp","backgroundColor","shadowOffset","width","height"],"sourceRoot":"../../src","sources":["util.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGO,SAASC,aAAaA,CAC3BC,SAAoB,EACpBC,KAA2B,EAC3B;EACA,MAAMC,cAAc,GAAGC,uBAAU,CAACC,OAAO,CAAC,CAACJ,SAAS,EAAEC,KAAK,CAAC,CAAc;EAC1E,OAAO;IACL,GAAGC,cAAc;IACjBG,UAAU,EAAEC,sBAAsB,CAACJ,cAAc,CAACG,UAAU,IAAI,QAAQ,CAAC;IACzEE,eAAe,EAAEL,cAAc,CAACK,eAAe,GAC3CL,cAAc,CAACK,eAAe,GAC9B,aAAa;IACjBC,YAAY,EAAEN,cAAc,CAACM,YAAY,GACrCN,cAAc,CAACM,YAAY,GAC3B;MAACC,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAC;EAC1B,CAAC;AACH;;AAEA;AACA;AACA,SAASJ,sBAAsBA,CAC7BD,UAAmC,EACjB;EAClB,QAAQA,UAAU;IAChB,KAAK,QAAQ;MACX,OAAO,QAAQ;IACjB,KAAK,MAAM;MACT,OAAO,MAAM;IACf,KAAK,GAAG;IACR,KAAK,KAAK;IACV,KAAK,YAAY;MACf,OAAO,YAAY;IACrB,KAAK,GAAG;IACR,KAAK,KAAK;MACR,OAAO,YAAY;IACrB,KAAK,GAAG;IACR,KAAK,KAAK;IACV,KAAK,OAAO;MACV,OAAO,OAAO;IAChB,KAAK,GAAG;IACR,KAAK,KAAK;IACV,KAAK,SAAS;MACZ,OAAO,QAAQ;IACjB,KAAK,GAAG;IACR,KAAK,KAAK;IACV,KAAK,QAAQ;MACX,OAAO,QAAQ;IACjB,KAAK,GAAG;IACR,KAAK,KAAK;IACV,KAAK,UAAU;MACb,OAAO,UAAU;IACnB,KAAK,GAAG;IACR,KAAK,KAAK;MACR,OAAO,UAAU;IACnB,KAAK,GAAG;IACR,KAAK,KAAK;MACR,OAAO,MAAM;IACf,KAAK,GAAG;IACR,KAAK,KAAK;IACV,KAAK,OAAO;MACV,OAAO,OAAO;IAChB;MACE,OAAO,QAAQ;EACnB;AACF","ignoreList":[]}
@@ -0,0 +1,49 @@
1
+ import {
2
+ type CodegenTypes,
3
+ type ColorValue,
4
+ type ViewProps,
5
+ codegenNativeComponent,
6
+ } from 'react-native'
7
+
8
+ interface TargetedEvent {
9
+ target: CodegenTypes.Int32
10
+ }
11
+
12
+ type TextDecorationLine = 'none' | 'underline' | 'line-through'
13
+
14
+ type TextDecorationStyle = 'solid' | 'double' | 'dotted' | 'dashed'
15
+
16
+ export type NativeFontWeight =
17
+ | 'normal'
18
+ | 'bold'
19
+ | 'ultraLight'
20
+ | 'light'
21
+ | 'medium'
22
+ | 'semibold'
23
+ | 'heavy'
24
+
25
+ type FontStyle = 'normal' | 'italic'
26
+
27
+ type TextAlign = 'auto' | 'left' | 'right' | 'center' | 'justify'
28
+
29
+ interface NativeProps extends ViewProps {
30
+ text: string
31
+ color?: ColorValue
32
+ fontSize?: CodegenTypes.Float
33
+ fontStyle?: CodegenTypes.WithDefault<FontStyle, 'normal'>
34
+ fontWeight?: CodegenTypes.WithDefault<NativeFontWeight, 'normal'>
35
+ fontFamily?: string
36
+ letterSpacing?: CodegenTypes.Float
37
+ lineHeight?: CodegenTypes.Float
38
+ textDecorationLine?: CodegenTypes.WithDefault<TextDecorationLine, 'none'>
39
+ textDecorationStyle?: CodegenTypes.WithDefault<TextDecorationStyle, 'solid'>
40
+ textDecorationColor?: ColorValue
41
+ textAlign?: CodegenTypes.WithDefault<TextAlign, 'auto'>
42
+ shadowRadius?: CodegenTypes.WithDefault<CodegenTypes.Float, 0>
43
+ onPress?: CodegenTypes.BubblingEventHandler<TargetedEvent>
44
+ onLongPress?: CodegenTypes.BubblingEventHandler<TargetedEvent>
45
+ }
46
+
47
+ export default codegenNativeComponent<NativeProps>('RNUITextViewChild', {
48
+ excludedPlatforms: ['android'],
49
+ })
@@ -0,0 +1,53 @@
1
+ import {
2
+ type CodegenTypes,
3
+ type ViewProps,
4
+ codegenNativeComponent,
5
+ } from 'react-native'
6
+
7
+ interface TargetedEvent {
8
+ target: CodegenTypes.Int32
9
+ }
10
+
11
+ interface TextLayoutEvent extends TargetedEvent {
12
+ lines: string[]
13
+ }
14
+
15
+ /**
16
+ * Event fired when text selection changes in the UITextView.
17
+ * @property target - The view tag identifier
18
+ * @property start - The start index of the selected range (0-based)
19
+ * @property end - The end index of the selected range (0-based, exclusive)
20
+ */
21
+ interface SelectionChangeEvent extends TargetedEvent {
22
+ start: CodegenTypes.Int32
23
+ end: CodegenTypes.Int32
24
+ }
25
+
26
+ type EllipsizeMode = 'head' | 'middle' | 'tail' | 'clip'
27
+
28
+ interface NativeProps extends ViewProps {
29
+ numberOfLines?: CodegenTypes.Int32
30
+ allowFontScaling?: CodegenTypes.WithDefault<boolean, true>
31
+ ellipsizeMode?: CodegenTypes.WithDefault<EllipsizeMode, 'tail'>
32
+ selectable?: boolean
33
+ onTextLayout?: CodegenTypes.BubblingEventHandler<TextLayoutEvent>
34
+ /**
35
+ * Callback fired when the text selection changes.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * <UITextView
40
+ * onSelectionChange={(event) => {
41
+ * console.log('Selection:', event.nativeEvent.start, event.nativeEvent.end);
42
+ * }}
43
+ * >
44
+ * Selectable text
45
+ * </UITextView>
46
+ * ```
47
+ */
48
+ onSelectionChange?: CodegenTypes.BubblingEventHandler<SelectionChangeEvent>
49
+ }
50
+
51
+ export default codegenNativeComponent<NativeProps>('RNUITextView', {
52
+ excludedPlatforms: ['android'],
53
+ })