react-native-typerich 0.1.14 → 1.1.1
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 +249 -10
- package/android/src/main/java/com/typerich/TypeRichTextInputView.kt +34 -3
- package/android/src/main/java/com/typerich/TypeRichTextInputViewManager.kt +10 -1
- package/lib/module/TypeRichTextInput.js +7 -2
- package/lib/module/TypeRichTextInput.js.map +1 -1
- package/lib/module/TypeRichTextInputNativeComponent.ts +10 -2
- package/lib/typescript/src/TypeRichTextInput.d.ts +2 -1
- package/lib/typescript/src/TypeRichTextInput.d.ts.map +1 -1
- package/lib/typescript/src/TypeRichTextInputNativeComponent.d.ts +3 -1
- package/lib/typescript/src/TypeRichTextInputNativeComponent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/TypeRichTextInput.tsx +9 -3
- package/src/TypeRichTextInputNativeComponent.ts +10 -2
package/README.md
CHANGED
|
@@ -11,36 +11,266 @@ npm install react-native-typerich
|
|
|
11
11
|
|
|
12
12
|
## Usage
|
|
13
13
|
|
|
14
|
-
```
|
|
14
|
+
```jsx
|
|
15
15
|
import { TypeRichTextInput } from 'react-native-typerich';
|
|
16
16
|
|
|
17
17
|
// ...
|
|
18
|
-
|
|
19
18
|
<TypeRichTextInput
|
|
20
|
-
ref={
|
|
19
|
+
ref={inputRef}
|
|
20
|
+
value={value}
|
|
21
21
|
style={styles.typeRichTextInput}
|
|
22
22
|
placeholder="Type here..."
|
|
23
23
|
placeholderTextColor="rgb(0, 26, 114)"
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
editable={true}
|
|
25
|
+
selectionColor="deepskyblue"
|
|
26
|
+
cursorColor="dodgerblue"
|
|
26
27
|
autoCapitalize="words"
|
|
28
|
+
autoFocus
|
|
27
29
|
onChangeText={(text: string) => console.log(text)}
|
|
28
30
|
onFocus={() => console.log('focused')}
|
|
29
31
|
onBlur={() => console.log('blurred')}
|
|
30
32
|
onChangeSelection={(e: { start: number, end: number, text: string }) =>
|
|
31
33
|
console.log(e)
|
|
32
34
|
}
|
|
33
|
-
androidExperimentalSynchronousEvents={true}
|
|
34
|
-
multiline
|
|
35
|
-
numberOfLines={5}
|
|
36
35
|
onPasteImageData={(e) => {
|
|
36
|
+
setImage(e);
|
|
37
37
|
console.log(e);
|
|
38
38
|
}}
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
androidExperimentalSynchronousEvents={true} // not tested very well
|
|
40
|
+
multiline
|
|
41
|
+
numberOfLines={5}
|
|
42
|
+
lineHeight={22}
|
|
43
|
+
fontFamily="serif"
|
|
44
|
+
fontStyle="italic"
|
|
45
|
+
fontWeight={'700'}
|
|
46
|
+
fontSize={26}
|
|
47
|
+
color="darkgreen"
|
|
41
48
|
/>;
|
|
42
49
|
```
|
|
43
50
|
|
|
51
|
+
## Props
|
|
52
|
+
|
|
53
|
+
- **Props that works Same as React Native's Default `TextInput`:**
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
value?: string;
|
|
57
|
+
autoFocus?: boolean;
|
|
58
|
+
editable?: boolean;
|
|
59
|
+
defaultValue?: string;
|
|
60
|
+
placeholder?: string;
|
|
61
|
+
placeholderTextColor?: ColorValue;
|
|
62
|
+
cursorColor?: ColorValue;
|
|
63
|
+
selectionColor?: ColorValue;
|
|
64
|
+
autoCapitalize?: string;
|
|
65
|
+
scrollEnabled?: boolean;
|
|
66
|
+
secureTextEntry?: boolean;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- **Styling Props you need to pass externally:**
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
color?: ColorValue;
|
|
73
|
+
fontSize?: Float;
|
|
74
|
+
fontFamily?: string;
|
|
75
|
+
fontWeight?: string;
|
|
76
|
+
fontStyle?: string;
|
|
77
|
+
lineHeight?: Float;
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
- **props that have some bugs:**
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
multiline?: boolean;
|
|
84
|
+
numberOfLines?: Int32;
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
> using this togather adds some extra height sometimes.
|
|
88
|
+
> use multline without numberOfLines and it works fine
|
|
89
|
+
> use `maxHeight` instead of number of lines
|
|
90
|
+
|
|
91
|
+
> [!NOTE]
|
|
92
|
+
> This is not a Major bug and the change is unnoticable
|
|
93
|
+
|
|
94
|
+
## Events
|
|
95
|
+
|
|
96
|
+
### 1. onFocus
|
|
97
|
+
|
|
98
|
+
callback signature
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
onFocus?: () => void;
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 2. onBlur
|
|
105
|
+
|
|
106
|
+
callback signature
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
onBlur?: () => void;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 3. onChangeText
|
|
113
|
+
|
|
114
|
+
callback signature
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
onChangeText?: (value: string) => void;
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 4. onChangeSelection
|
|
121
|
+
|
|
122
|
+
callback signature
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
onChangeSelection?: (event: {
|
|
126
|
+
start: number;
|
|
127
|
+
end: number;
|
|
128
|
+
text: string;
|
|
129
|
+
}) => void;
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 4. onPasteImageData
|
|
133
|
+
|
|
134
|
+
> fires on when user paste image
|
|
135
|
+
|
|
136
|
+
callback signature
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
onPasteImageData?: (data: {
|
|
140
|
+
uri: string;
|
|
141
|
+
type: string;
|
|
142
|
+
fileName: string;
|
|
143
|
+
fileSize: Double;
|
|
144
|
+
source: 'keyboard' | 'clipboard' | 'context_menu'; // it never receives source as 'context_menu' and will be removed in future we suggest not using it
|
|
145
|
+
error?: { message: string };
|
|
146
|
+
}) => void;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Event props
|
|
150
|
+
|
|
151
|
+
- `uri`: uri of the image, can be directly used or passed to Image comp
|
|
152
|
+
- `type`: mime type of image
|
|
153
|
+
- `fileName`: File name of image (always starts with `typerich_` prefix)
|
|
154
|
+
- `fileSize`: File Size in bytes
|
|
155
|
+
- `source`: its enum with two possible values
|
|
156
|
+
- `keyboard`: if its pasted from gboard's clipboard or is a sticker or something similar
|
|
157
|
+
- `clipboard`: if its pasted from context menu (long press)
|
|
158
|
+
- `error`: error message if there is any
|
|
159
|
+
|
|
160
|
+
## Commands
|
|
161
|
+
|
|
162
|
+
### 1. focus()
|
|
163
|
+
|
|
164
|
+
> use to get programmatic focus on TextInput
|
|
165
|
+
|
|
166
|
+
Command signature
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
focus: () => void;
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
useage
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
inputRef.current?.focus();
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### 2. blur()
|
|
179
|
+
|
|
180
|
+
> use to programmatically blur TextInput
|
|
181
|
+
|
|
182
|
+
Command signature
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
blur: () => void;
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
useage
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
inputRef.current?.blur();
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### 3. setText(text)
|
|
195
|
+
|
|
196
|
+
> use to set the value of TextInput (replaces whole content)
|
|
197
|
+
|
|
198
|
+
> [!NOTE]
|
|
199
|
+
> it does not updates selection automatically use have to call `setSelection()`
|
|
200
|
+
|
|
201
|
+
Command signature
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
setText: (text: string) => void;
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
useage
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
inputRef.current?.setText('This is Text');
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### 4. insertTextAt(start, end, text)
|
|
214
|
+
|
|
215
|
+
> use to insert value at specific position (keeps content of TextInput)
|
|
216
|
+
|
|
217
|
+
> [!NOTE]
|
|
218
|
+
> it preserves the cursor and updates the selection
|
|
219
|
+
> no need to call the `setSelection` after this
|
|
220
|
+
|
|
221
|
+
Command signature
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
insertTextAt: (start: number, end: number, text: string) => void;
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
useage
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
inputRef.current?.insertTextAt(4, 6, 'This is Text');
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### 5. setSelection(start, end)
|
|
234
|
+
|
|
235
|
+
> use to set the value of TextInput (replaces whole content)
|
|
236
|
+
|
|
237
|
+
Command signature
|
|
238
|
+
|
|
239
|
+
```ts
|
|
240
|
+
setSelection: (start: number, end: number) => void;
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
useage
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
inputRef.current?.setSelection(4, 6);
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### 6. getNativeRef()
|
|
250
|
+
|
|
251
|
+
> use to get the internal ref object of the TypeRichTextInput
|
|
252
|
+
|
|
253
|
+
> [!NOTE]
|
|
254
|
+
> you mostly does not need to use this
|
|
255
|
+
> only use this when you need to use the ref in certain cases like following
|
|
256
|
+
|
|
257
|
+
```ts
|
|
258
|
+
const hostRef = input?.getNativeRef?.();
|
|
259
|
+
const node = findNodeHandle(hostRef); // findNodeHandle is from 'react-native'
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Command signature
|
|
263
|
+
|
|
264
|
+
```ts
|
|
265
|
+
getNativeRef: () => any | null;
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
useage
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
inputRef.current?.getNativeRef();
|
|
272
|
+
```
|
|
273
|
+
|
|
44
274
|
## Contributing
|
|
45
275
|
|
|
46
276
|
- [Development workflow](CONTRIBUTING.md#development-workflow)
|
|
@@ -54,3 +284,12 @@ MIT
|
|
|
54
284
|
---
|
|
55
285
|
|
|
56
286
|
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
287
|
+
|
|
288
|
+
## Credits
|
|
289
|
+
|
|
290
|
+
- **Divyanshu Patil** – Author & maintainer
|
|
291
|
+
- Built with help from the open-source community ❤️
|
|
292
|
+
|
|
293
|
+
### special thanks to [Software-Mansion](https://github.com/software-mansion) for the custom shadow node code
|
|
294
|
+
|
|
295
|
+
checkout [react-native-enriched](https://github.com/software-mansion/react-native-enriched) by [software-mansion](https://github.com/software-mansion)
|
|
@@ -65,7 +65,6 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
65
65
|
private var isSettingTextFromJS = false
|
|
66
66
|
private var isInitialized = false
|
|
67
67
|
|
|
68
|
-
|
|
69
68
|
constructor(context: Context) : super(context) {
|
|
70
69
|
prepareComponent()
|
|
71
70
|
}
|
|
@@ -303,6 +302,10 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
303
302
|
super.onSelectionChanged(selStart, selEnd)
|
|
304
303
|
if (isDuringTransaction) return
|
|
305
304
|
|
|
305
|
+
dispatchSelectionChangeEvent(selStart,selEnd)
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
fun dispatchSelectionChangeEvent(selStart: Int, selEnd: Int){
|
|
306
309
|
val reactContext = context as? ReactContext ?: return
|
|
307
310
|
val dispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, id)
|
|
308
311
|
?: return
|
|
@@ -321,7 +324,6 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
321
324
|
)
|
|
322
325
|
}
|
|
323
326
|
|
|
324
|
-
|
|
325
327
|
override fun clearFocus() {
|
|
326
328
|
super.clearFocus()
|
|
327
329
|
inputMethodManager?.hideSoftInputFromWindow(windowToken, 0)
|
|
@@ -329,6 +331,7 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
329
331
|
|
|
330
332
|
override fun onFocusChanged(focused: Boolean, direction: Int, previouslyFocusedRect: Rect?) {
|
|
331
333
|
super.onFocusChanged(focused, direction, previouslyFocusedRect)
|
|
334
|
+
|
|
332
335
|
val reactContext = context as ReactContext
|
|
333
336
|
val surfaceId = UIManagerHelper.getSurfaceId(reactContext)
|
|
334
337
|
val dispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, id)
|
|
@@ -355,7 +358,8 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
355
358
|
fun requestFocusProgrammatically() {
|
|
356
359
|
requestFocus()
|
|
357
360
|
inputMethodManager?.showSoftInput(this, 0)
|
|
358
|
-
setSelection(text?.length ?: 0)
|
|
361
|
+
// setSelection(text?.length ?: 0)
|
|
362
|
+
setSelection(selectionStart,selectionEnd)
|
|
359
363
|
}
|
|
360
364
|
|
|
361
365
|
fun setMultiline(enabled: Boolean) {
|
|
@@ -422,6 +426,28 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
422
426
|
}
|
|
423
427
|
}
|
|
424
428
|
|
|
429
|
+
fun insertTextAt(start: Int, end: Int, insert: String) {
|
|
430
|
+
val editable = editableText ?: return
|
|
431
|
+
|
|
432
|
+
val safeStart = start.coerceIn(0, editable.length)
|
|
433
|
+
val safeEnd = end.coerceIn(0, editable.length)
|
|
434
|
+
|
|
435
|
+
var newCursor = safeStart
|
|
436
|
+
|
|
437
|
+
isSettingTextFromJS = true
|
|
438
|
+
try {
|
|
439
|
+
runAsATransaction {
|
|
440
|
+
editable.replace(safeStart, safeEnd, insert) // this will not emit selectionChange event cause of transaction
|
|
441
|
+
newCursor = safeStart + insert.length
|
|
442
|
+
setSelection(newCursor, newCursor)
|
|
443
|
+
}
|
|
444
|
+
} finally {
|
|
445
|
+
isSettingTextFromJS = false
|
|
446
|
+
layoutManager.invalidateLayout()
|
|
447
|
+
}
|
|
448
|
+
dispatchSelectionChangeEvent(newCursor,newCursor) // manually emit selectionChange event
|
|
449
|
+
}
|
|
450
|
+
|
|
425
451
|
fun setAutoFocus(autoFocus: Boolean) {
|
|
426
452
|
this.autoFocus = autoFocus
|
|
427
453
|
}
|
|
@@ -470,6 +496,7 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
470
496
|
val sizePx = ceil(PixelUtil.toPixelFromSP(size))
|
|
471
497
|
fontSize = sizePx
|
|
472
498
|
setTextSize(TypedValue.COMPLEX_UNIT_PX, sizePx)
|
|
499
|
+
layoutManager.invalidateLayout()
|
|
473
500
|
}
|
|
474
501
|
|
|
475
502
|
fun setFontFamily(family: String?) {
|
|
@@ -513,6 +540,10 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
513
540
|
}
|
|
514
541
|
|
|
515
542
|
fun setSecureTextEntry(isSecure: Boolean) {
|
|
543
|
+
if (isSecure) {
|
|
544
|
+
setMultiline(false)
|
|
545
|
+
maxLines = 1
|
|
546
|
+
}
|
|
516
547
|
transformationMethod =
|
|
517
548
|
if (isSecure)
|
|
518
549
|
android.text.method.PasswordTransformationMethod.getInstance()
|
|
@@ -53,6 +53,11 @@ class TypeRichTextInputViewManager :
|
|
|
53
53
|
view?.setDefaultValue(value)
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
@ReactProp(name = "value")
|
|
57
|
+
override fun setValue(view: TypeRichTextInputView?, value: String?) {
|
|
58
|
+
view?.setValue(value)
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
@ReactProp(name = "color")
|
|
57
62
|
override fun setColor(view: TypeRichTextInputView, value: Int?) {
|
|
58
63
|
if (value != null) view.setTextColor(value)
|
|
@@ -175,10 +180,14 @@ class TypeRichTextInputViewManager :
|
|
|
175
180
|
view?.clearFocus()
|
|
176
181
|
}
|
|
177
182
|
|
|
178
|
-
override fun
|
|
183
|
+
override fun setText(view: TypeRichTextInputView?, text: String) {
|
|
179
184
|
view?.setValue(text)
|
|
180
185
|
}
|
|
181
186
|
|
|
187
|
+
override fun insertTextAt(view: TypeRichTextInputView?,start:Int,end:Int, text:String) {
|
|
188
|
+
view?.insertTextAt(start,end, text)
|
|
189
|
+
}
|
|
190
|
+
|
|
182
191
|
override fun setSelection(
|
|
183
192
|
view: TypeRichTextInputView?,
|
|
184
193
|
start: Int,
|
|
@@ -46,9 +46,9 @@ const TypeRichTextInput = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
46
46
|
Commands.blur(nativeRef.current);
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
|
-
|
|
49
|
+
setText: text => {
|
|
50
50
|
if (isAndroid && nativeRef.current) {
|
|
51
|
-
Commands.
|
|
51
|
+
Commands.setText(nativeRef.current, text);
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
setSelection(start, end) {
|
|
@@ -56,6 +56,11 @@ const TypeRichTextInput = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
56
56
|
Commands.setSelection(nativeRef.current, start, end);
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
|
+
insertTextAt: (start, end, text) => {
|
|
60
|
+
if (isAndroid && nativeRef.current) {
|
|
61
|
+
Commands.insertTextAt(nativeRef.current, start, end, text);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
59
64
|
getNativeRef: () => nativeRef.current
|
|
60
65
|
}));
|
|
61
66
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useImperativeHandle","useRef","Platform","View","Commands","jsx","_jsx","NativeTypeRichTextInput","OS","require","default","normalizeEvent","event","nativeEvent","isAndroid","TypeRichTextInput","props","ref","nativeRef","focus","current","blur","
|
|
1
|
+
{"version":3,"names":["forwardRef","useImperativeHandle","useRef","Platform","View","Commands","jsx","_jsx","NativeTypeRichTextInput","OS","require","default","normalizeEvent","event","nativeEvent","isAndroid","TypeRichTextInput","props","ref","nativeRef","focus","current","blur","setText","text","setSelection","start","end","insertTextAt","getNativeRef","handlePasteImage","data","undefined","onPasteImageData","handleOnChangeTextEvent","e","onChangeText","value","handleonChangeSelectionEvent","onChangeSelection","androidExperimentalSynchronousEvents","onFocus","onBlur","restProps","onInputFocus","onInputBlur","onPasteImage"],"sourceRoot":"../../src","sources":["TypeRichTextInput.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,mBAAmB,EAAEC,MAAM,QAAkB,OAAO;AAGzE,SAASC,QAAQ,EAAEC,IAAI,QAAQ,cAAc;AAE7C,SACEC,QAAQ,QAKH,oCAAoC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5C,IAAIC,uBAA4B;AAEhC,IAAIL,QAAQ,CAACM,EAAE,KAAK,SAAS,EAAE;EAC7BD,uBAAuB,GACrBE,OAAO,CAAC,oCAAoC,CAAC,CAACC,OAAO;AACzD,CAAC,MAAM;EACL;EACAH,uBAAuB,GAAGJ,IAAI;AAChC;AAGA,OAAO,SAASQ,cAAcA,CAAIC,KAA0B,EAAK;EAC/D,IAAIA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,aAAa,IAAIA,KAAK,EAAE;IAChE,OAAQA,KAAK,CAAwBC,WAAW;EAClD;EACA,OAAOD,KAAK;AACd;;AAEA;;AA+BA,MAAME,SAAS,GAAGZ,QAAQ,CAACM,EAAE,KAAK,SAAS;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMO,iBAAiB,gBAAGhB,UAAU,CAClC,CAACiB,KAA6B,EAAEC,GAA8B,KAAK;EACjE,MAAMC,SAAS,GAAGjB,MAAM,CAAC,IAAI,CAAC;EAE9BD,mBAAmB,CAACiB,GAAG,EAAE,OAAO;IAC9BE,KAAK,EAAEA,CAAA,KAAM;MACX,IAAIL,SAAS,IAAII,SAAS,CAACE,OAAO,EAAE;QAClChB,QAAQ,CAACe,KAAK,CAACD,SAAS,CAACE,OAAO,CAAC;MACnC;IACF,CAAC;IACDC,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CAAC;EAC/B;EAEA,SAASC,4BAA4BA,CACnCzB,KAAuE,EACvE;IACA,MAAMsB,CAAC,GAAGvB,cAAc,CAACC,KAAK,CAAC;IAC/BI,KAAK,CAACsB,iBAAiB,GAAG;MACxBb,KAAK,EAAES,CAAC,CAACT,KAAK;MACdC,GAAG,EAAEQ,CAAC,CAACR,GAAG;MACVH,IAAI,EAAEW,CAAC,CAACX;IACV,CAAC,CAAC;EACJ;;EAEA;EACA,MAAM;IACJ;IACAgB,oCAAoC;IACpCD,iBAAiB;IACjBH,YAAY;IACZH,gBAAgB;IAChBQ,OAAO;IACPC,MAAM;IAEN;IACA,GAAGC;EACL,CAAC,GAAG1B,KAAK;EACT;;EAEA,oBACEV,IAAA,CAACC,uBAAuB;IACtBU,GAAG,EAAEC,SAAU;IAAA,IACVJ,SAAS,GAAGE,KAAK,GAAG0B,SAAS;IAClCC,YAAY,EAAEA,CAAA,KAAM3B,KAAK,CAACwB,OAAO,GAAG,CAAE;IACtCI,WAAW,EAAEA,CAAA,KAAM5B,KAAK,CAACyB,MAAM,GAAG,CAAE;IACpCN,YAAY,EAAEF,uBAAwB;IACtCK,iBAAiB,EAAED,4BAA6B;IAChDQ,YAAY,EAAEhB;EAAiB,CAChC,CAAC;AAEN,CACF,CAAC;AAED,eAAed,iBAAiB","ignoreList":[]}
|
|
@@ -34,6 +34,7 @@ export interface onPasteImageEventData {
|
|
|
34
34
|
|
|
35
35
|
export interface TypeRichTextInputNativeProps extends ViewProps {
|
|
36
36
|
// base props
|
|
37
|
+
value?: string;
|
|
37
38
|
autoFocus?: boolean;
|
|
38
39
|
editable?: boolean;
|
|
39
40
|
defaultValue?: string;
|
|
@@ -77,7 +78,13 @@ interface NativeCommands {
|
|
|
77
78
|
// General commands
|
|
78
79
|
focus: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
79
80
|
blur: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
80
|
-
|
|
81
|
+
setText: (viewRef: React.ElementRef<ComponentType>, text: string) => void;
|
|
82
|
+
insertTextAt: (
|
|
83
|
+
viewRef: React.ElementRef<ComponentType>,
|
|
84
|
+
start: Int32,
|
|
85
|
+
end: Int32,
|
|
86
|
+
text: string
|
|
87
|
+
) => void;
|
|
81
88
|
setSelection: (
|
|
82
89
|
viewRef: React.ElementRef<ComponentType>,
|
|
83
90
|
start: Int32,
|
|
@@ -90,8 +97,9 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
|
90
97
|
// General commands
|
|
91
98
|
'focus',
|
|
92
99
|
'blur',
|
|
93
|
-
'
|
|
100
|
+
'setText',
|
|
94
101
|
'setSelection',
|
|
102
|
+
'insertTextAt',
|
|
95
103
|
],
|
|
96
104
|
});
|
|
97
105
|
|
|
@@ -17,7 +17,8 @@ export interface TypeRichTextInputProps extends Omit<TypeRichTextInputNativeProp
|
|
|
17
17
|
export interface TypeRichTextInputRef {
|
|
18
18
|
focus: () => void;
|
|
19
19
|
blur: () => void;
|
|
20
|
-
|
|
20
|
+
setText: (text: string) => void;
|
|
21
|
+
insertTextAt: (start: number, end: number, text: string) => void;
|
|
21
22
|
setSelection: (start: number, end: number) => void;
|
|
22
23
|
getNativeRef: () => any | null;
|
|
23
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeRichTextInput.d.ts","sourceRoot":"","sources":["../../../src/TypeRichTextInput.tsx"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EAClC,MAAM,oCAAoC,CAAC;AAW5C,KAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,WAAW,EAAE,CAAC,CAAA;CAAE,CAAC;AAElD,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAK/D;AAGD,MAAM,WAAW,sBACf,SAAQ,IAAI,CACV,4BAA4B,EAC1B,cAAc,GACd,mBAAmB,GACnB,cAA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AAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;KACd,KAAK,IAAI,CAAC;IACX,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;CAC1D;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,YAAY,EAAE,MAAM,GAAG,GAAG,IAAI,CAAC;CAChC;AAID;;;;;;;;;;GAUG;AACH,QAAA,MAAM,iBAAiB,yHAmGtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -21,6 +21,7 @@ export interface onPasteImageEventData {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
export interface TypeRichTextInputNativeProps extends ViewProps {
|
|
24
|
+
value?: string;
|
|
24
25
|
autoFocus?: boolean;
|
|
25
26
|
editable?: boolean;
|
|
26
27
|
defaultValue?: string;
|
|
@@ -51,7 +52,8 @@ type ComponentType = HostComponent<TypeRichTextInputNativeProps>;
|
|
|
51
52
|
interface NativeCommands {
|
|
52
53
|
focus: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
53
54
|
blur: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
54
|
-
|
|
55
|
+
setText: (viewRef: React.ElementRef<ComponentType>, text: string) => void;
|
|
56
|
+
insertTextAt: (viewRef: React.ElementRef<ComponentType>, start: Int32, end: Int32, text: string) => void;
|
|
55
57
|
setSelection: (viewRef: React.ElementRef<ComponentType>, start: Int32, end: Int32) => void;
|
|
56
58
|
}
|
|
57
59
|
export declare const Commands: NativeCommands;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeRichTextInputNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/TypeRichTextInputNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EACV,oBAAoB,EACpB,MAAM,EACN,WAAW,EACX,kBAAkB,EAClB,KAAK,EACL,KAAK,EACN,MAAM,2CAA2C,CAAC;AAEnD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,EAAE,KAAK,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,cAAc,CAAC;IAClD,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7B;AAED,MAAM,WAAW,4BAA6B,SAAQ,SAAS;IAE7D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM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E,KAAK,EACZ,GAAG,EAAE,KAAK,KACP,IAAI,CAAC;CACX;AAED,eAAO,MAAM,QAAQ,EAAE,cASrB,CAAC;wBAOE,aAAa,CAAC,4BAA4B,CAAC;AALhD,wBAKiD"}
|
package/package.json
CHANGED
|
@@ -54,7 +54,8 @@ export interface TypeRichTextInputProps
|
|
|
54
54
|
export interface TypeRichTextInputRef {
|
|
55
55
|
focus: () => void;
|
|
56
56
|
blur: () => void;
|
|
57
|
-
|
|
57
|
+
setText: (text: string) => void;
|
|
58
|
+
insertTextAt: (start: number, end: number, text: string) => void;
|
|
58
59
|
setSelection: (start: number, end: number) => void;
|
|
59
60
|
getNativeRef: () => any | null;
|
|
60
61
|
}
|
|
@@ -87,9 +88,9 @@ const TypeRichTextInput = forwardRef(
|
|
|
87
88
|
Commands.blur(nativeRef.current);
|
|
88
89
|
}
|
|
89
90
|
},
|
|
90
|
-
|
|
91
|
+
setText: (text: string) => {
|
|
91
92
|
if (isAndroid && nativeRef.current) {
|
|
92
|
-
Commands.
|
|
93
|
+
Commands.setText(nativeRef.current, text);
|
|
93
94
|
}
|
|
94
95
|
},
|
|
95
96
|
setSelection(start, end) {
|
|
@@ -97,6 +98,11 @@ const TypeRichTextInput = forwardRef(
|
|
|
97
98
|
Commands.setSelection(nativeRef.current, start, end);
|
|
98
99
|
}
|
|
99
100
|
},
|
|
101
|
+
insertTextAt: (start: number, end: number, text: string) => {
|
|
102
|
+
if (isAndroid && nativeRef.current) {
|
|
103
|
+
Commands.insertTextAt(nativeRef.current, start, end, text);
|
|
104
|
+
}
|
|
105
|
+
},
|
|
100
106
|
getNativeRef: () => nativeRef.current,
|
|
101
107
|
}));
|
|
102
108
|
|
|
@@ -34,6 +34,7 @@ export interface onPasteImageEventData {
|
|
|
34
34
|
|
|
35
35
|
export interface TypeRichTextInputNativeProps extends ViewProps {
|
|
36
36
|
// base props
|
|
37
|
+
value?: string;
|
|
37
38
|
autoFocus?: boolean;
|
|
38
39
|
editable?: boolean;
|
|
39
40
|
defaultValue?: string;
|
|
@@ -77,7 +78,13 @@ interface NativeCommands {
|
|
|
77
78
|
// General commands
|
|
78
79
|
focus: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
79
80
|
blur: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
80
|
-
|
|
81
|
+
setText: (viewRef: React.ElementRef<ComponentType>, text: string) => void;
|
|
82
|
+
insertTextAt: (
|
|
83
|
+
viewRef: React.ElementRef<ComponentType>,
|
|
84
|
+
start: Int32,
|
|
85
|
+
end: Int32,
|
|
86
|
+
text: string
|
|
87
|
+
) => void;
|
|
81
88
|
setSelection: (
|
|
82
89
|
viewRef: React.ElementRef<ComponentType>,
|
|
83
90
|
start: Int32,
|
|
@@ -90,8 +97,9 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
|
90
97
|
// General commands
|
|
91
98
|
'focus',
|
|
92
99
|
'blur',
|
|
93
|
-
'
|
|
100
|
+
'setText',
|
|
94
101
|
'setSelection',
|
|
102
|
+
'insertTextAt',
|
|
95
103
|
],
|
|
96
104
|
});
|
|
97
105
|
|