@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.
- package/LICENSE +20 -0
- package/README.md +188 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/CMakeLists.txt +28 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/RNUITextViewSpec-generated.cpp +22 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/RNUITextViewSpec.h +24 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.cpp +23 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.h +25 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/EventEmitters.cpp +61 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/EventEmitters.h +49 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/Props.cpp +151 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/Props.h +236 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/RNUITextViewSpecJSI.h +19 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/ShadowNodes.cpp +18 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/ShadowNodes.h +43 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/States.cpp +16 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNUITextViewSpec/States.h +22 -0
- package/ios/RNUITextView.h +13 -0
- package/ios/RNUITextView.mm +338 -0
- package/ios/RNUITextViewChild.h +24 -0
- package/ios/RNUITextViewChild.mm +72 -0
- package/ios/RNUITextViewChildComponentDescriptor.h +13 -0
- package/ios/RNUITextViewChildShadowNode.cpp +6 -0
- package/ios/RNUITextViewChildShadowNode.h +16 -0
- package/ios/RNUITextViewComponentDescriptor.h +13 -0
- package/ios/RNUITextViewManager.mm +36 -0
- package/ios/RNUITextViewShadowNode.cpp +139 -0
- package/ios/RNUITextViewShadowNode.h +48 -0
- package/ios/generated/build/generated/ios/ReactCodegen/RNUITextViewSpec/RNUITextViewSpec-generated.mm +16 -0
- package/ios/generated/build/generated/ios/ReactCodegen/RNUITextViewSpec/RNUITextViewSpec.h +38 -0
- package/ios/generated/build/generated/ios/ReactCodegen/RNUITextViewSpecJSI.h +19 -0
- package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.cpp +23 -0
- package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/ComponentDescriptors.h +25 -0
- package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/EventEmitters.cpp +61 -0
- package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/EventEmitters.h +49 -0
- package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/Props.cpp +151 -0
- package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/Props.h +236 -0
- package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/RCTComponentViewHelpers.h +24 -0
- package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/ShadowNodes.cpp +18 -0
- package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/ShadowNodes.h +43 -0
- package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/States.cpp +16 -0
- package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNUITextViewSpec/States.h +22 -0
- package/lib/commonjs/RNUITextViewChildNativeComponent.ts +49 -0
- package/lib/commonjs/RNUITextViewNativeComponent.ts +53 -0
- package/lib/commonjs/Text.js +111 -0
- package/lib/commonjs/Text.js.map +1 -0
- package/lib/commonjs/Text.web.js +23 -0
- package/lib/commonjs/Text.web.js.map +1 -0
- package/lib/commonjs/index.js +17 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/util.js +66 -0
- package/lib/commonjs/util.js.map +1 -0
- package/lib/module/RNUITextViewChildNativeComponent.ts +49 -0
- package/lib/module/RNUITextViewNativeComponent.ts +53 -0
- package/lib/module/Text.js +106 -0
- package/lib/module/Text.js.map +1 -0
- package/lib/module/Text.web.js +19 -0
- package/lib/module/Text.web.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/util.js +62 -0
- package/lib/module/util.js.map +1 -0
- package/lib/typescript/commonjs/example/src/App.d.ts +3 -0
- package/lib/typescript/commonjs/example/src/App.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/RNUITextViewChildNativeComponent.d.ts +29 -0
- package/lib/typescript/commonjs/src/RNUITextViewChildNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/RNUITextViewNativeComponent.d.ts +43 -0
- package/lib/typescript/commonjs/src/RNUITextViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Text.d.ts +25 -0
- package/lib/typescript/commonjs/src/Text.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Text.web.d.ts +19 -0
- package/lib/typescript/commonjs/src/Text.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/util.d.ts +163 -0
- package/lib/typescript/commonjs/src/util.d.ts.map +1 -0
- package/lib/typescript/module/example/src/App.d.ts +3 -0
- package/lib/typescript/module/example/src/App.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/RNUITextViewChildNativeComponent.d.ts +29 -0
- package/lib/typescript/module/src/RNUITextViewChildNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/RNUITextViewNativeComponent.d.ts +43 -0
- package/lib/typescript/module/src/RNUITextViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/Text.d.ts +25 -0
- package/lib/typescript/module/src/Text.d.ts.map +1 -0
- package/lib/typescript/module/src/Text.web.d.ts +19 -0
- package/lib/typescript/module/src/Text.web.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +2 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/util.d.ts +163 -0
- package/lib/typescript/module/src/util.d.ts.map +1 -0
- package/package.json +185 -0
- package/react-native-uitextview.podspec +34 -0
- package/react-native.config.js +28 -0
- package/scripts/ensure-rnc-cli-executable.js +19 -0
- package/src/RNUITextViewChildNativeComponent.ts +49 -0
- package/src/RNUITextViewNativeComponent.ts +53 -0
- package/src/Text.tsx +125 -0
- package/src/Text.web.tsx +22 -0
- package/src/index.tsx +1 -0
- package/src/util.ts +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-25 Bluesky PBC
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
### Note about support for this library
|
|
4
|
+
|
|
5
|
+
This library was made for the
|
|
6
|
+
[Bluesky Social App](https://github.com/bluesky-social/social-app). Support for this library
|
|
7
|
+
is very much dependent on two factors:
|
|
8
|
+
|
|
9
|
+
1. Do we have time to implement a feature or fix an issue?
|
|
10
|
+
2. How important is the feature to Bluesky or does it fix an issue present in Bluesky?
|
|
11
|
+
|
|
12
|
+
If there are features that you want to see in this library that don't already exist and
|
|
13
|
+
likely (or definitely) do not greatly improve the experience in Bluesky, please feel free
|
|
14
|
+
to submit a PR! Of course, you should also feel free to make feature suggestions or
|
|
15
|
+
bug reports as well, and whenever free time is available the might be worked on. Just know
|
|
16
|
+
it might take some time.
|
|
17
|
+
|
|
18
|
+
Thank you!
|
|
19
|
+
|
|
20
|
+
# React Native UITextView
|
|
21
|
+
|
|
22
|
+
The `Text` implementation in React Native much more closely resembles `UILabel` on iOS. Unfortunately, this prevents
|
|
23
|
+
the user from being able to highlight text for selection. The only copy behavior that is possible is to copy the
|
|
24
|
+
entire block of text.
|
|
25
|
+
|
|
26
|
+
`UITextView` however allows a user to highlight portions of the text block for copying,
|
|
27
|
+
translation, or other native capabilities.
|
|
28
|
+
|
|
29
|
+
React Native UITextView takes advantage of `UITextView` to allow for both types of copying
|
|
30
|
+
on iOS: highlight and copy or the current, `UILabel` behavior to just copy the entire
|
|
31
|
+
block of text.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
> [!WARNING]
|
|
36
|
+
> The final version of this package that supports the old React Native architecture is `1.4.0`. All versions `2.x` and
|
|
37
|
+
> higher support only the new architecture. Unfortunately I do not have time to maintain support for both architectures.
|
|
38
|
+
> Version `1.4.0` however is stable and - aside from the still missing features from the base `<Text>` component, should
|
|
39
|
+
> work the same as `2.x` and higher.
|
|
40
|
+
|
|
41
|
+
> [!NOTE]
|
|
42
|
+
> Version 2.0.0 of `@bsky.app/react-native-uitextview` is tested against and used in production with React Nave 0.79. No other versions
|
|
43
|
+
> are officially supported. As there have been a number of changes to the text layout engine in the new architecture, things
|
|
44
|
+
> may be broken if you are not using this version of React Native with this package. Generally, these problems are inside of
|
|
45
|
+
> `RNUITextViewShadowNode.cpp`.
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
yarn add @bsky.app/react-native-uitextview
|
|
49
|
+
cd ios
|
|
50
|
+
pod install
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Limitations
|
|
54
|
+
|
|
55
|
+
React Native UITextView can - for the most part - be used as a drop-in replacement
|
|
56
|
+
for existing blocks of `Text`. However, there are a few limitations:
|
|
57
|
+
|
|
58
|
+
- Children of `UITextView` may only be other UITextView children (base `Text` children
|
|
59
|
+
will be converted to `UITextView` children, so you only need to adjust the wrapper).
|
|
60
|
+
This means that things like in-line images are not supported as they are in the base
|
|
61
|
+
React Native `Text` component.
|
|
62
|
+
- A few styles have not yet been implemented, but all should be possible.
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
Usage of this component is the same as the base React Native `Text` component. It
|
|
67
|
+
can be imported as `Text` from `@bsky.app/react-native-uitextview`, so in most cases you only
|
|
68
|
+
need to replace your current `Text` import with this one.
|
|
69
|
+
|
|
70
|
+
Aside from the few limitations above, all of the existing styles and props that you
|
|
71
|
+
are using for `Text` should work. On non-iOS platforms, the base React Native `Text`
|
|
72
|
+
will always be used. On iOS, the base React Native `Text` component will be used
|
|
73
|
+
unless the `selectable` and the `uiTextView` props are both `true`.
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import {UITextView as Text} from '@bsky.app/react-native-uitextview'
|
|
77
|
+
|
|
78
|
+
function SomeView() {
|
|
79
|
+
return (
|
|
80
|
+
<View style={{flex: 1}}>
|
|
81
|
+
<Text
|
|
82
|
+
style={{color: 'green', lineHeight: 20, fontSize: 14}}
|
|
83
|
+
selectable
|
|
84
|
+
uiTextView>
|
|
85
|
+
This is some highlightable text! It uses UITextView
|
|
86
|
+
</Text>
|
|
87
|
+
<Text
|
|
88
|
+
style={{color: 'blue', lineHeight: 20, fontSize: 14}}
|
|
89
|
+
selectable // Note we do not add the uiTextView prop
|
|
90
|
+
>
|
|
91
|
+
This text still uses the base Text component. It can only be copied.
|
|
92
|
+
</Text>
|
|
93
|
+
<Text
|
|
94
|
+
style={{color: 'red', lineHeight: 20, fontSize: 14}}
|
|
95
|
+
uiTextView // Note we do not add the selectable prop
|
|
96
|
+
>
|
|
97
|
+
This text still uses the base Text component. It can't be highlighted or
|
|
98
|
+
copied at all.
|
|
99
|
+
</Text>
|
|
100
|
+
</View>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Nesting of `UITextView` components is supported. For example, if you have styles
|
|
106
|
+
that should be applied only to a portion of the text, or an `onPress` callback to
|
|
107
|
+
add to a link.
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
<Text style={{fontSize: 14}} selectable uiTextView>
|
|
111
|
+
This is some text that's highlightable with{' '}
|
|
112
|
+
<Text
|
|
113
|
+
style={{color: 'blue', textDecorationLine: 'underline'}}
|
|
114
|
+
onPress={() => Linking.openURL('https://google.com')}>
|
|
115
|
+
a link
|
|
116
|
+
</Text>
|
|
117
|
+
.
|
|
118
|
+
</Text>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Selection Detection
|
|
122
|
+
|
|
123
|
+
`UITextView` supports native selection change events via the `onSelectionChange` callback.
|
|
124
|
+
This provides real-time notifications when the user selects or deselects text, eliminating
|
|
125
|
+
the need for polling-based selection detection.
|
|
126
|
+
|
|
127
|
+
### Usage
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
import {UITextView as Text} from '@bsky.app/react-native-uitextview'
|
|
131
|
+
|
|
132
|
+
function SelectableText() {
|
|
133
|
+
const [selectedText, setSelectedText] = React.useState('')
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<Text
|
|
137
|
+
selectable
|
|
138
|
+
uiTextView
|
|
139
|
+
onSelectionChange={event => {
|
|
140
|
+
const {start, end} = event.nativeEvent
|
|
141
|
+
// Extract selected text from your content string
|
|
142
|
+
const text = content.substring(start, end)
|
|
143
|
+
setSelectedText(text)
|
|
144
|
+
}}>
|
|
145
|
+
Selectable text content
|
|
146
|
+
</Text>
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Event Properties
|
|
152
|
+
|
|
153
|
+
The `onSelectionChange` event provides the following properties:
|
|
154
|
+
|
|
155
|
+
- `nativeEvent.target` - The view tag identifier
|
|
156
|
+
- `nativeEvent.start` - The start index of the selected range (0-based)
|
|
157
|
+
- `nativeEvent.end` - The end index of the selected range (0-based, exclusive)
|
|
158
|
+
|
|
159
|
+
### Notes
|
|
160
|
+
|
|
161
|
+
- Works correctly with multibyte characters (e.g., Arabic, emojis)
|
|
162
|
+
- Only available on iOS when using `uiTextView={true}`
|
|
163
|
+
- The event fires even when selection is cleared (`start === end`), including
|
|
164
|
+
when the library clears it itself on a tap outside the text view
|
|
165
|
+
- The event fires on every selection-edge adjustment — dragging a selection
|
|
166
|
+
handle to extend by a few characters will fire many times. Consumers driving
|
|
167
|
+
expensive work off this event should debounce
|
|
168
|
+
|
|
169
|
+
## Contributing
|
|
170
|
+
|
|
171
|
+
Contributions are always welcome - and encouraged. Please note however that it might take
|
|
172
|
+
time for PRs to be reviewed and merged, and they might not be merged at all. This library
|
|
173
|
+
was created to support text selection in the
|
|
174
|
+
[Bluesky Social App](https://github.com/bluesky-social/social-app). Contributions that may
|
|
175
|
+
affect the proper functioning of the component in Bluesky will not be merged.
|
|
176
|
+
|
|
177
|
+
Some ideas for great contributions that we do not have time to properly implement:
|
|
178
|
+
|
|
179
|
+
- Full support for all RN styles
|
|
180
|
+
- Accessibility improvements
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
Bluesky Social PBC has committed to a software patent non-aggression pledge. For details see [the original announcement](https://bsky.social/about/blog/10-01-2025-patent-pledge).
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
cmake_minimum_required(VERSION 3.13)
|
|
7
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
+
|
|
9
|
+
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNUITextViewSpec/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_RNUITextViewSpec
|
|
13
|
+
OBJECT
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_RNUITextViewSpec PUBLIC . react/renderer/components/RNUITextViewSpec)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_RNUITextViewSpec
|
|
21
|
+
fbjni
|
|
22
|
+
jsi
|
|
23
|
+
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
+
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
+
reactnative
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
target_compile_reactnative_options(react_codegen_RNUITextViewSpec PRIVATE)
|
|
@@ -0,0 +1,22 @@
|
|
|
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: GenerateModuleJniCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "RNUITextViewSpec.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
std::shared_ptr<TurboModule> RNUITextViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
18
|
+
|
|
19
|
+
return nullptr;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,24 @@
|
|
|
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: GenerateModuleJniH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <ReactCommon/JavaTurboModule.h>
|
|
14
|
+
#include <ReactCommon/TurboModule.h>
|
|
15
|
+
#include <jsi/jsi.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
JSI_EXPORT
|
|
22
|
+
std::shared_ptr<TurboModule> RNUITextViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
23
|
+
|
|
24
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,23 @@
|
|
|
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: GenerateComponentDescriptorCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/RNUITextViewSpec/ComponentDescriptors.h>
|
|
12
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
13
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
void RNUITextViewSpec_registerComponentDescriptorsFromCodegen(
|
|
18
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
|
19
|
+
registry->add(concreteComponentDescriptorProvider<RNUITextViewChildComponentDescriptor>());
|
|
20
|
+
registry->add(concreteComponentDescriptorProvider<RNUITextViewComponentDescriptor>());
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,25 @@
|
|
|
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: GenerateComponentDescriptorH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <react/renderer/components/RNUITextViewSpec/ShadowNodes.h>
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
using RNUITextViewChildComponentDescriptor = ConcreteComponentDescriptor<RNUITextViewChildShadowNode>;
|
|
20
|
+
using RNUITextViewComponentDescriptor = ConcreteComponentDescriptor<RNUITextViewShadowNode>;
|
|
21
|
+
|
|
22
|
+
void RNUITextViewSpec_registerComponentDescriptorsFromCodegen(
|
|
23
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
24
|
+
|
|
25
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,61 @@
|
|
|
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: GenerateEventEmitterCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/RNUITextViewSpec/EventEmitters.h>
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
namespace facebook::react {
|
|
15
|
+
|
|
16
|
+
void RNUITextViewChildEventEmitter::onPress(OnPress event) const {
|
|
17
|
+
dispatchEvent("press", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
18
|
+
auto payload = jsi::Object(runtime);
|
|
19
|
+
payload.setProperty(runtime, "target", event.target);
|
|
20
|
+
return payload;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
void RNUITextViewChildEventEmitter::onLongPress(OnLongPress event) const {
|
|
26
|
+
dispatchEvent("longPress", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
27
|
+
auto payload = jsi::Object(runtime);
|
|
28
|
+
payload.setProperty(runtime, "target", event.target);
|
|
29
|
+
return payload;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
void RNUITextViewEventEmitter::onTextLayout(OnTextLayout event) const {
|
|
35
|
+
dispatchEvent("textLayout", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
36
|
+
auto payload = jsi::Object(runtime);
|
|
37
|
+
payload.setProperty(runtime, "target", event.target);
|
|
38
|
+
|
|
39
|
+
auto lines = jsi::Array(runtime, event.lines.size());
|
|
40
|
+
size_t linesIndex = 0;
|
|
41
|
+
for (auto linesValue : event.lines) {
|
|
42
|
+
lines.setValueAtIndex(runtime, linesIndex++, linesValue);
|
|
43
|
+
}
|
|
44
|
+
payload.setProperty(runtime, "lines", lines);
|
|
45
|
+
|
|
46
|
+
return payload;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
void RNUITextViewEventEmitter::onSelectionChange(OnSelectionChange event) const {
|
|
52
|
+
dispatchEvent("selectionChange", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
53
|
+
auto payload = jsi::Object(runtime);
|
|
54
|
+
payload.setProperty(runtime, "target", event.target);
|
|
55
|
+
payload.setProperty(runtime, "start", event.start);
|
|
56
|
+
payload.setProperty(runtime, "end", event.end);
|
|
57
|
+
return payload;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,49 @@
|
|
|
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: GenerateEventEmitterH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
class RNUITextViewChildEventEmitter : public ViewEventEmitter {
|
|
17
|
+
public:
|
|
18
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
19
|
+
|
|
20
|
+
struct OnPress {
|
|
21
|
+
int target;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
struct OnLongPress {
|
|
25
|
+
int target;
|
|
26
|
+
};
|
|
27
|
+
void onPress(OnPress value) const;
|
|
28
|
+
|
|
29
|
+
void onLongPress(OnLongPress value) const;
|
|
30
|
+
};
|
|
31
|
+
class RNUITextViewEventEmitter : public ViewEventEmitter {
|
|
32
|
+
public:
|
|
33
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
34
|
+
|
|
35
|
+
struct OnTextLayout {
|
|
36
|
+
int target;
|
|
37
|
+
std::vector<std::string> lines;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
struct OnSelectionChange {
|
|
41
|
+
int target;
|
|
42
|
+
int start;
|
|
43
|
+
int end;
|
|
44
|
+
};
|
|
45
|
+
void onTextLayout(OnTextLayout value) const;
|
|
46
|
+
|
|
47
|
+
void onSelectionChange(OnSelectionChange value) const;
|
|
48
|
+
};
|
|
49
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,151 @@
|
|
|
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: GeneratePropsCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/RNUITextViewSpec/Props.h>
|
|
12
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
13
|
+
#include <react/renderer/core/propsConversions.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
RNUITextViewChildProps::RNUITextViewChildProps(
|
|
18
|
+
const PropsParserContext &context,
|
|
19
|
+
const RNUITextViewChildProps &sourceProps,
|
|
20
|
+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
21
|
+
|
|
22
|
+
text(convertRawProp(context, rawProps, "text", sourceProps.text, {})),
|
|
23
|
+
color(convertRawProp(context, rawProps, "color", sourceProps.color, {})),
|
|
24
|
+
fontSize(convertRawProp(context, rawProps, "fontSize", sourceProps.fontSize, {0.0})),
|
|
25
|
+
fontStyle(convertRawProp(context, rawProps, "fontStyle", sourceProps.fontStyle, {RNUITextViewChildFontStyle::Normal})),
|
|
26
|
+
fontWeight(convertRawProp(context, rawProps, "fontWeight", sourceProps.fontWeight, {RNUITextViewChildFontWeight::Normal})),
|
|
27
|
+
fontFamily(convertRawProp(context, rawProps, "fontFamily", sourceProps.fontFamily, {})),
|
|
28
|
+
letterSpacing(convertRawProp(context, rawProps, "letterSpacing", sourceProps.letterSpacing, {0.0})),
|
|
29
|
+
lineHeight(convertRawProp(context, rawProps, "lineHeight", sourceProps.lineHeight, {0.0})),
|
|
30
|
+
textDecorationLine(convertRawProp(context, rawProps, "textDecorationLine", sourceProps.textDecorationLine, {RNUITextViewChildTextDecorationLine::None})),
|
|
31
|
+
textDecorationStyle(convertRawProp(context, rawProps, "textDecorationStyle", sourceProps.textDecorationStyle, {RNUITextViewChildTextDecorationStyle::Solid})),
|
|
32
|
+
textDecorationColor(convertRawProp(context, rawProps, "textDecorationColor", sourceProps.textDecorationColor, {})),
|
|
33
|
+
textAlign(convertRawProp(context, rawProps, "textAlign", sourceProps.textAlign, {RNUITextViewChildTextAlign::Auto})),
|
|
34
|
+
shadowRadius(convertRawProp(context, rawProps, "shadowRadius", sourceProps.shadowRadius, {0.0})) {}
|
|
35
|
+
|
|
36
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
37
|
+
ComponentName RNUITextViewChildProps::getDiffPropsImplementationTarget() const {
|
|
38
|
+
return "RNUITextViewChild";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
folly::dynamic RNUITextViewChildProps::getDiffProps(
|
|
42
|
+
const Props* prevProps) const {
|
|
43
|
+
static const auto defaultProps = RNUITextViewChildProps();
|
|
44
|
+
const RNUITextViewChildProps* oldProps = prevProps == nullptr
|
|
45
|
+
? &defaultProps
|
|
46
|
+
: static_cast<const RNUITextViewChildProps*>(prevProps);
|
|
47
|
+
if (this == oldProps) {
|
|
48
|
+
return folly::dynamic::object();
|
|
49
|
+
}
|
|
50
|
+
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
|
51
|
+
|
|
52
|
+
if (text != oldProps->text) {
|
|
53
|
+
result["text"] = text;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (color != oldProps->color) {
|
|
57
|
+
result["color"] = *color;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if ((fontSize != oldProps->fontSize) && !(std::isnan(fontSize) && std::isnan(oldProps->fontSize))) {
|
|
61
|
+
result["fontSize"] = fontSize;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (fontStyle != oldProps->fontStyle) {
|
|
65
|
+
result["fontStyle"] = toDynamic(fontStyle);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (fontWeight != oldProps->fontWeight) {
|
|
69
|
+
result["fontWeight"] = toDynamic(fontWeight);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (fontFamily != oldProps->fontFamily) {
|
|
73
|
+
result["fontFamily"] = fontFamily;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if ((letterSpacing != oldProps->letterSpacing) && !(std::isnan(letterSpacing) && std::isnan(oldProps->letterSpacing))) {
|
|
77
|
+
result["letterSpacing"] = letterSpacing;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if ((lineHeight != oldProps->lineHeight) && !(std::isnan(lineHeight) && std::isnan(oldProps->lineHeight))) {
|
|
81
|
+
result["lineHeight"] = lineHeight;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (textDecorationLine != oldProps->textDecorationLine) {
|
|
85
|
+
result["textDecorationLine"] = toDynamic(textDecorationLine);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (textDecorationStyle != oldProps->textDecorationStyle) {
|
|
89
|
+
result["textDecorationStyle"] = toDynamic(textDecorationStyle);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (textDecorationColor != oldProps->textDecorationColor) {
|
|
93
|
+
result["textDecorationColor"] = *textDecorationColor;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (textAlign != oldProps->textAlign) {
|
|
97
|
+
result["textAlign"] = toDynamic(textAlign);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if ((shadowRadius != oldProps->shadowRadius) && !(std::isnan(shadowRadius) && std::isnan(oldProps->shadowRadius))) {
|
|
101
|
+
result["shadowRadius"] = shadowRadius;
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
#endif
|
|
106
|
+
RNUITextViewProps::RNUITextViewProps(
|
|
107
|
+
const PropsParserContext &context,
|
|
108
|
+
const RNUITextViewProps &sourceProps,
|
|
109
|
+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
110
|
+
|
|
111
|
+
numberOfLines(convertRawProp(context, rawProps, "numberOfLines", sourceProps.numberOfLines, {0})),
|
|
112
|
+
allowFontScaling(convertRawProp(context, rawProps, "allowFontScaling", sourceProps.allowFontScaling, {true})),
|
|
113
|
+
ellipsizeMode(convertRawProp(context, rawProps, "ellipsizeMode", sourceProps.ellipsizeMode, {RNUITextViewEllipsizeMode::Tail})),
|
|
114
|
+
selectable(convertRawProp(context, rawProps, "selectable", sourceProps.selectable, {false})) {}
|
|
115
|
+
|
|
116
|
+
#ifdef RN_SERIALIZABLE_STATE
|
|
117
|
+
ComponentName RNUITextViewProps::getDiffPropsImplementationTarget() const {
|
|
118
|
+
return "RNUITextView";
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
folly::dynamic RNUITextViewProps::getDiffProps(
|
|
122
|
+
const Props* prevProps) const {
|
|
123
|
+
static const auto defaultProps = RNUITextViewProps();
|
|
124
|
+
const RNUITextViewProps* oldProps = prevProps == nullptr
|
|
125
|
+
? &defaultProps
|
|
126
|
+
: static_cast<const RNUITextViewProps*>(prevProps);
|
|
127
|
+
if (this == oldProps) {
|
|
128
|
+
return folly::dynamic::object();
|
|
129
|
+
}
|
|
130
|
+
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
|
131
|
+
|
|
132
|
+
if (numberOfLines != oldProps->numberOfLines) {
|
|
133
|
+
result["numberOfLines"] = numberOfLines;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (allowFontScaling != oldProps->allowFontScaling) {
|
|
137
|
+
result["allowFontScaling"] = allowFontScaling;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (ellipsizeMode != oldProps->ellipsizeMode) {
|
|
141
|
+
result["ellipsizeMode"] = toDynamic(ellipsizeMode);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (selectable != oldProps->selectable) {
|
|
145
|
+
result["selectable"] = selectable;
|
|
146
|
+
}
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
#endif
|
|
150
|
+
|
|
151
|
+
} // namespace facebook::react
|