react-native-typerich 0.1.0 → 0.1.3
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 +27 -8
- package/TypeRichTextInput.podspec +2 -1
- package/android/src/main/java/com/typerich/TypeRichTextInputView.kt +33 -9
- package/android/src/main/java/com/typerich/TypeRichTextInputViewManager.kt +6 -0
- package/android/src/main/java/com/typerich/events/OnChangeSelectionEvent.kt +1 -1
- package/android/src/main/java/com/typerich/events/OnPasteImageEvent.kt +2 -0
- package/android/src/main/java/com/typerich/utils/EnumPasteSource.kt +12 -0
- package/ios/TypeRichTextInputView.h +2 -1
- package/ios/TypeRichTextInputView.mm +1 -20
- package/ios/TypeRichTextInputViewManager.mm +21 -0
- package/lib/module/TypeRichTextInput.js +42 -4
- package/lib/module/TypeRichTextInput.js.map +1 -1
- package/lib/module/TypeRichTextInputNativeComponent.ts +7 -3
- package/lib/typescript/src/TypeRichTextInput.d.ts +22 -22
- package/lib/typescript/src/TypeRichTextInput.d.ts.map +1 -1
- package/lib/typescript/src/TypeRichTextInputNativeComponent.d.ts +3 -2
- package/lib/typescript/src/TypeRichTextInputNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +7 -3
- package/src/TypeRichTextInput.tsx +70 -36
- package/src/TypeRichTextInputNativeComponent.ts +7 -3
- package/src/index.tsx +1 -0
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/ComponentDescriptors.cpp +0 -22
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/ComponentDescriptors.h +0 -24
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/EventEmitters.cpp +0 -70
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/EventEmitters.h +0 -59
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/Props.cpp +0 -132
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/Props.h +0 -51
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/RCTComponentViewHelpers.h +0 -80
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/ShadowNodes.cpp +0 -17
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/ShadowNodes.h +0 -23
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/States.cpp +0 -16
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/States.h +0 -20
package/README.md
CHANGED
|
@@ -1,27 +1,46 @@
|
|
|
1
1
|
# react-native-type-rich-text-input
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Drop in TextInput replacement with inbuilt support for Image Pasting and Gboard stickers
|
|
4
|
+
currently available only for android
|
|
4
5
|
|
|
5
6
|
## Installation
|
|
6
7
|
|
|
7
|
-
|
|
8
8
|
```sh
|
|
9
|
-
npm install react-native-
|
|
9
|
+
npm install react-native-typerich
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
## Usage
|
|
14
13
|
|
|
15
|
-
|
|
16
14
|
```js
|
|
17
|
-
import {
|
|
15
|
+
import { TypeRichTextInput } from 'react-native-typerich';
|
|
18
16
|
|
|
19
17
|
// ...
|
|
20
18
|
|
|
21
|
-
<
|
|
19
|
+
<TypeRichTextInput
|
|
20
|
+
ref={ref}
|
|
21
|
+
style={styles.typeRichTextInput}
|
|
22
|
+
placeholder="Type here..."
|
|
23
|
+
placeholderTextColor="rgb(0, 26, 114)"
|
|
24
|
+
selectionColor="red"
|
|
25
|
+
cursorColor="green"
|
|
26
|
+
autoCapitalize="words"
|
|
27
|
+
onChangeText={(text: string) => console.log(text)}
|
|
28
|
+
onFocus={() => console.log('focused')}
|
|
29
|
+
onBlur={() => console.log('blurred')}
|
|
30
|
+
onChangeSelection={(e: { start: number, end: number, text: string }) =>
|
|
31
|
+
console.log(e)
|
|
32
|
+
}
|
|
33
|
+
androidExperimentalSynchronousEvents={true}
|
|
34
|
+
multiline
|
|
35
|
+
numberOfLines={5}
|
|
36
|
+
onPasteImageData={(e) => {
|
|
37
|
+
console.log(e);
|
|
38
|
+
}}
|
|
39
|
+
defaultValue="TypeRichTextInput"
|
|
40
|
+
keyboardAppearance="dark" // ios only
|
|
41
|
+
/>;
|
|
22
42
|
```
|
|
23
43
|
|
|
24
|
-
|
|
25
44
|
## Contributing
|
|
26
45
|
|
|
27
46
|
- [Development workflow](CONTRIBUTING.md#development-workflow)
|
|
@@ -13,7 +13,8 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.platforms = { :ios => min_ios_version_supported }
|
|
14
14
|
s.source = { :git => "https://github.com/divyanshu-patil/react-native-typerich.git", :tag => "#{s.version}" }
|
|
15
15
|
|
|
16
|
-
s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
|
|
16
|
+
# s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
|
|
17
|
+
s.source_files = []
|
|
17
18
|
s.private_header_files = "ios/**/*.h"
|
|
18
19
|
|
|
19
20
|
install_modules_dependencies(s)
|
|
@@ -33,7 +33,9 @@ import com.facebook.react.views.text.ReactTypefaceUtils.parseFontWeight
|
|
|
33
33
|
import com.typerich.events.OnChangeTextEvent
|
|
34
34
|
import com.typerich.events.OnInputBlurEvent
|
|
35
35
|
import com.typerich.events.OnInputFocusEvent
|
|
36
|
+
import com.typerich.events.OnChangeSelectionEvent
|
|
36
37
|
import com.typerich.events.OnPasteImageEvent
|
|
38
|
+
import com.typerich.utils.EnumPasteSource
|
|
37
39
|
import java.io.File
|
|
38
40
|
import kotlin.math.ceil
|
|
39
41
|
|
|
@@ -58,7 +60,7 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
58
60
|
private var fontWeight: Int = ReactConstants.UNSET
|
|
59
61
|
private var defaultValue: CharSequence? = null
|
|
60
62
|
private var defaultValueDirty: Boolean = false
|
|
61
|
-
|
|
63
|
+
private var keyboardAppearance: String = "default"
|
|
62
64
|
private var inputMethodManager: InputMethodManager? = null
|
|
63
65
|
|
|
64
66
|
constructor(context: Context) : super(context) {
|
|
@@ -161,7 +163,9 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
161
163
|
"image/*"
|
|
162
164
|
}
|
|
163
165
|
|
|
164
|
-
val
|
|
166
|
+
val source = EnumPasteSource.KEYBOARD.value
|
|
167
|
+
|
|
168
|
+
val meta = buildMetaForUri(uri, mime, source)
|
|
165
169
|
dispatchImagePasteEvent(meta)
|
|
166
170
|
|
|
167
171
|
if ((flags and InputConnectionCompat.INPUT_CONTENT_GRANT_READ_URI_PERMISSION) != 0) {
|
|
@@ -186,15 +190,17 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
186
190
|
|
|
187
191
|
// uri
|
|
188
192
|
item.uri?.let { uri ->
|
|
193
|
+
val source = EnumPasteSource.CLIPBOARD.value
|
|
189
194
|
val mime = context.contentResolver.getType(uri) ?: "image/*"
|
|
190
|
-
dispatchImagePasteEvent(buildMetaForUri(uri, mime))
|
|
195
|
+
dispatchImagePasteEvent(buildMetaForUri(uri, mime, source))
|
|
191
196
|
return true
|
|
192
197
|
}
|
|
193
198
|
|
|
194
199
|
// intent
|
|
195
200
|
item.intent?.data?.let { uri ->
|
|
201
|
+
val source = EnumPasteSource.CLIPBOARD.value
|
|
196
202
|
val mime = context.contentResolver.getType(uri) ?: "image/*"
|
|
197
|
-
dispatchImagePasteEvent(buildMetaForUri(uri, mime))
|
|
203
|
+
dispatchImagePasteEvent(buildMetaForUri(uri, mime, source))
|
|
198
204
|
return true
|
|
199
205
|
}
|
|
200
206
|
|
|
@@ -208,9 +214,9 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
208
214
|
}
|
|
209
215
|
|
|
210
216
|
// --- helper: convert content URI to cached file metadata ---
|
|
211
|
-
private data class PasteImageMeta(val fileName: String, val fileSize: Long, val type: String, val uri: String)
|
|
217
|
+
private data class PasteImageMeta(val fileName: String, val fileSize: Long,val source: String, val type: String, val uri: String)
|
|
212
218
|
|
|
213
|
-
private fun buildMetaForUri(srcUri: Uri, mime: String): PasteImageMeta {
|
|
219
|
+
private fun buildMetaForUri(srcUri: Uri, mime: String,source: String): PasteImageMeta {
|
|
214
220
|
val ext = when (mime) {
|
|
215
221
|
"image/png" -> ".png"
|
|
216
222
|
"image/jpeg", "image/jpg" -> ".jpg"
|
|
@@ -228,7 +234,8 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
228
234
|
fileName = temp.name,
|
|
229
235
|
fileSize = temp.length(),
|
|
230
236
|
type = mime,
|
|
231
|
-
uri = Uri.fromFile(temp).toString()
|
|
237
|
+
uri = Uri.fromFile(temp).toString(),
|
|
238
|
+
source = source
|
|
232
239
|
)
|
|
233
240
|
}
|
|
234
241
|
|
|
@@ -238,7 +245,7 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
238
245
|
val surfaceId = UIManagerHelper.getSurfaceId(reactContext)
|
|
239
246
|
try {
|
|
240
247
|
dispatcher?.dispatchEvent(
|
|
241
|
-
OnPasteImageEvent(surfaceId, id, meta.uri,meta.type,meta.fileName,meta.fileSize.toDouble(),null,experimentalSynchronousEvents)
|
|
248
|
+
OnPasteImageEvent(surfaceId, id, meta.uri,meta.type,meta.fileName,meta.fileSize.toDouble(),meta.source,null,experimentalSynchronousEvents)
|
|
242
249
|
)
|
|
243
250
|
} catch (e: Exception) {
|
|
244
251
|
e.printStackTrace()
|
|
@@ -278,9 +285,26 @@ class TypeRichTextInputView : AppCompatEditText {
|
|
|
278
285
|
|
|
279
286
|
override fun onSelectionChanged(selStart: Int, selEnd: Int) {
|
|
280
287
|
super.onSelectionChanged(selStart, selEnd)
|
|
281
|
-
|
|
288
|
+
|
|
289
|
+
val reactContext = context as? ReactContext ?: return
|
|
290
|
+
val dispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, id)
|
|
291
|
+
?: return
|
|
292
|
+
|
|
293
|
+
val surfaceId = UIManagerHelper.getSurfaceId(reactContext)
|
|
294
|
+
|
|
295
|
+
dispatcher.dispatchEvent(
|
|
296
|
+
OnChangeSelectionEvent(
|
|
297
|
+
surfaceId,
|
|
298
|
+
id,
|
|
299
|
+
selStart,
|
|
300
|
+
selEnd,
|
|
301
|
+
text?.toString() ?: "",
|
|
302
|
+
experimentalSynchronousEvents
|
|
303
|
+
)
|
|
304
|
+
)
|
|
282
305
|
}
|
|
283
306
|
|
|
307
|
+
|
|
284
308
|
override fun clearFocus() {
|
|
285
309
|
super.clearFocus()
|
|
286
310
|
inputMethodManager?.hideSoftInputFromWindow(windowToken, 0)
|
|
@@ -128,6 +128,12 @@ class TypeRichTextInputViewManager :
|
|
|
128
128
|
view?.setSecureTextEntry(value)
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
@ReactProp(name = "keyboardAppearance")
|
|
132
|
+
override fun setKeyboardAppearance(
|
|
133
|
+
view: TypeRichTextInputView,
|
|
134
|
+
appearance: String?
|
|
135
|
+
) {
|
|
136
|
+
}
|
|
131
137
|
|
|
132
138
|
override fun onAfterUpdateTransaction(view: TypeRichTextInputView) {
|
|
133
139
|
super.onAfterUpdateTransaction(view)
|
|
@@ -4,7 +4,7 @@ import com.facebook.react.bridge.Arguments
|
|
|
4
4
|
import com.facebook.react.bridge.WritableMap
|
|
5
5
|
import com.facebook.react.uimanager.events.Event
|
|
6
6
|
|
|
7
|
-
class OnChangeSelectionEvent(surfaceId: Int, viewId: Int, private val
|
|
7
|
+
class OnChangeSelectionEvent(surfaceId: Int, viewId: Int, private val start: Int, private val end: Int, private val text: String, private val experimentalSynchronousEvents: Boolean) :
|
|
8
8
|
Event<OnChangeSelectionEvent>(surfaceId, viewId) {
|
|
9
9
|
|
|
10
10
|
override fun getEventName(): String {
|
|
@@ -11,6 +11,7 @@ class OnPasteImageEvent(
|
|
|
11
11
|
private val type: String,
|
|
12
12
|
private val fileName: String,
|
|
13
13
|
private val fileSize: Double, // RN Int32 maps to Kotlin Int
|
|
14
|
+
private val source: String, // clipboard or gboard
|
|
14
15
|
private val errorMessage: String? = null,
|
|
15
16
|
private val experimentalSynchronousEvents: Boolean
|
|
16
17
|
) : Event<OnPasteImageEvent>(surfaceId, viewId) {
|
|
@@ -25,6 +26,7 @@ class OnPasteImageEvent(
|
|
|
25
26
|
map.putString("type", type)
|
|
26
27
|
map.putString("fileName", fileName)
|
|
27
28
|
map.putDouble("fileSize", fileSize)
|
|
29
|
+
map.putString("source", source)
|
|
28
30
|
|
|
29
31
|
if (errorMessage != null) {
|
|
30
32
|
val errorMap = Arguments.createMap()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package com.typerich.utils
|
|
2
|
+
|
|
3
|
+
enum class EnumPasteSource(val value: String) {
|
|
4
|
+
KEYBOARD("keyboard"),
|
|
5
|
+
CLIPBOARD("clipboard"),
|
|
6
|
+
CONTEXT_MENU("context_menu");
|
|
7
|
+
|
|
8
|
+
companion object {
|
|
9
|
+
fun from(value: String): EnumPasteSource? =
|
|
10
|
+
values().find { it.value == value }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -41,11 +41,6 @@ using namespace facebook::react;
|
|
|
41
41
|
const auto &oldViewProps = *std::static_pointer_cast<TypeRichTextInputViewProps const>(_props);
|
|
42
42
|
const auto &newViewProps = *std::static_pointer_cast<TypeRichTextInputViewProps const>(props);
|
|
43
43
|
|
|
44
|
-
if (oldViewProps.color != newViewProps.color) {
|
|
45
|
-
NSString * colorToConvert = [[NSString alloc] initWithUTF8String: newViewProps.color.c_str()];
|
|
46
|
-
[_view setBackgroundColor:[self hexStringToColor:colorToConvert]];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
44
|
[super updateProps:props oldProps:oldProps];
|
|
50
45
|
}
|
|
51
46
|
|
|
@@ -54,18 +49,4 @@ Class<RCTComponentViewProtocol> TypeRichTextInputViewCls(void)
|
|
|
54
49
|
return TypeRichTextInputView.class;
|
|
55
50
|
}
|
|
56
51
|
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
NSString *noHashString = [stringToConvert stringByReplacingOccurrencesOfString:@"#" withString:@""];
|
|
60
|
-
NSScanner *stringScanner = [NSScanner scannerWithString:noHashString];
|
|
61
|
-
|
|
62
|
-
unsigned hex;
|
|
63
|
-
if (![stringScanner scanHexInt:&hex]) return nil;
|
|
64
|
-
int r = (hex >> 16) & 0xFF;
|
|
65
|
-
int g = (hex >> 8) & 0xFF;
|
|
66
|
-
int b = (hex) & 0xFF;
|
|
67
|
-
|
|
68
|
-
return [UIColor colorWithRed:r / 255.0f green:g / 255.0f blue:b / 255.0f alpha:1.0f];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@end
|
|
52
|
+
@end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
#import <React/RCTViewManager.h>
|
|
3
|
+
#import <React/RCTComponentViewFactory.h>
|
|
4
|
+
#import "TypeRichTextInputView.h"
|
|
5
|
+
|
|
6
|
+
@interface TypeRichTextInputViewManager : NSObject <RCTComponentViewProtocol>
|
|
7
|
+
@end
|
|
8
|
+
|
|
9
|
+
@implementation TypeRichTextInputViewManager
|
|
10
|
+
|
|
11
|
+
+ (NSString *)componentName
|
|
12
|
+
{
|
|
13
|
+
return @"TypeRichTextInputView";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
+ (Class)componentViewClass
|
|
17
|
+
{
|
|
18
|
+
return [TypeRichTextInputView class];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@end
|
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { forwardRef, useImperativeHandle, useRef } from 'react';
|
|
4
|
-
import
|
|
4
|
+
import { Platform, View } from 'react-native';
|
|
5
|
+
import { Commands } from './TypeRichTextInputNativeComponent';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
let NativeTypeRichTextInput;
|
|
8
|
+
if (Platform.OS === 'android') {
|
|
9
|
+
NativeTypeRichTextInput = require('./TypeRichTextInputNativeComponent').default;
|
|
10
|
+
} else {
|
|
11
|
+
// iOS fallback (temporary)
|
|
12
|
+
NativeTypeRichTextInput = View;
|
|
13
|
+
}
|
|
14
|
+
export function normalizeEvent(event) {
|
|
15
|
+
if (event && typeof event === 'object' && 'nativeEvent' in event) {
|
|
16
|
+
return event.nativeEvent;
|
|
17
|
+
}
|
|
18
|
+
return event;
|
|
19
|
+
}
|
|
5
20
|
|
|
6
21
|
// Public facing props (same as NativeProps but events normalized)
|
|
7
|
-
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* TypeRichTextInput
|
|
25
|
+
*
|
|
26
|
+
* A high-performance rich text input component with:
|
|
27
|
+
* - image pasting support
|
|
28
|
+
* - Fabric-based rendering
|
|
29
|
+
* - custom ShadowNode on Android
|
|
30
|
+
*
|
|
31
|
+
* iOS support is currently unavailable and renders a `View` comp as fallback
|
|
32
|
+
* we are planning to add support for ios too soon
|
|
33
|
+
*/
|
|
8
34
|
const TypeRichTextInput = /*#__PURE__*/forwardRef((props, ref) => {
|
|
9
35
|
const nativeRef = useRef(null);
|
|
10
36
|
useImperativeHandle(ref, () => ({
|
|
@@ -35,14 +61,26 @@ const TypeRichTextInput = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
35
61
|
props.onPasteImageData?.(data);
|
|
36
62
|
}
|
|
37
63
|
}
|
|
64
|
+
function handleOnChangeTextEvent(event) {
|
|
65
|
+
const e = normalizeEvent(event);
|
|
66
|
+
props.onChangeText?.(e.value);
|
|
67
|
+
}
|
|
68
|
+
function handleonChangeSelectionEvent(event) {
|
|
69
|
+
const e = normalizeEvent(event);
|
|
70
|
+
props.onChangeSelection?.({
|
|
71
|
+
start: e.start,
|
|
72
|
+
end: e.end,
|
|
73
|
+
text: e.text
|
|
74
|
+
});
|
|
75
|
+
}
|
|
38
76
|
return /*#__PURE__*/_jsx(NativeTypeRichTextInput, {
|
|
39
77
|
androidExperimentalSynchronousEvents: props.androidExperimentalSynchronousEvents,
|
|
40
78
|
ref: nativeRef,
|
|
41
79
|
...props,
|
|
42
80
|
onInputFocus: () => props.onFocus?.(),
|
|
43
81
|
onInputBlur: () => props.onBlur?.(),
|
|
44
|
-
onChangeText:
|
|
45
|
-
onChangeSelection:
|
|
82
|
+
onChangeText: handleOnChangeTextEvent,
|
|
83
|
+
onChangeSelection: handleonChangeSelectionEvent,
|
|
46
84
|
onPasteImage: handlePasteImage
|
|
47
85
|
});
|
|
48
86
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useImperativeHandle","useRef","
|
|
1
|
+
{"version":3,"names":["forwardRef","useImperativeHandle","useRef","Platform","View","Commands","jsx","_jsx","NativeTypeRichTextInput","OS","require","default","normalizeEvent","event","nativeEvent","TypeRichTextInput","props","ref","nativeRef","focus","current","blur","setValue","text","handlePasteImage","data","undefined","onPasteImageData","handleOnChangeTextEvent","e","onChangeText","value","handleonChangeSelectionEvent","onChangeSelection","start","end","androidExperimentalSynchronousEvents","onInputFocus","onFocus","onInputBlur","onBlur","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;;AA4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,iBAAiB,gBAAGf,UAAU,CAClC,CAACgB,KAA6B,EAAEC,GAA8B,KAAK;EACjE,MAAMC,SAAS,GAAGhB,MAAM,CAAC,IAAI,CAAC;EAE9BD,mBAAmB,CAACgB,GAAG,EAAE,OAAO;IAC9BE,KAAK,EAAEA,CAAA,KAAM;MACX,IAAID,SAAS,CAACE,OAAO,EAAE;QACrBf,QAAQ,CAACc,KAAK,CAACD,SAAS,CAACE,OAAO,CAAC;MACnC;IACF,CAAC;IACDC,IAAI,EAAEA,CAAA,KAAM;MACV,IAAIH,SAAS,CAACE,OAAO,EAAE;QACrBf,QAAQ,CAACgB,IAAI,CAACH,SAAS,CAACE,OAAO,CAAC;MAClC;IACF,CAAC;IACDE,QAAQ,EAAGC,IAAY,IAAK;MAC1B,IAAIL,SAAS,CAACE,OAAO,EAAE;QACrBf,QAAQ,CAACiB,QAAQ,CAACJ,SAAS,CAACE,OAAO,EAAEG,IAAI,CAAC;MAC5C;IACF;EACF,CAAC,CAAC,CAAC;;EAEH;AACJ;AACA;EACI,SAASC,gBAAgBA,CACvBX,KAIO,EACD;IACN;IACA,MAAMY,IAAuC,GAC3CZ,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,GAC9BA,KAAK,CAACC,WAAW,IAAID,KAAK,GAC1Ba,SAAS;IAEf,IAAID,IAAI,EAAE;MACRT,KAAK,CAACW,gBAAgB,GAAGF,IAA6B,CAAC;IACzD;EACF;EAEA,SAASG,uBAAuBA,CAC9Bf,KAA6D,EAC7D;IACA,MAAMgB,CAAC,GAAGjB,cAAc,CAACC,KAAK,CAAC;IAC/BG,KAAK,CAACc,YAAY,GAAGD,CAAC,CAACE,KAAK,CAAC;EAC/B;EAEA,SAASC,4BAA4BA,CACnCnB,KAAuE,EACvE;IACA,MAAMgB,CAAC,GAAGjB,cAAc,CAACC,KAAK,CAAC;IAC/BG,KAAK,CAACiB,iBAAiB,GAAG;MACxBC,KAAK,EAAEL,CAAC,CAACK,KAAK;MACdC,GAAG,EAAEN,CAAC,CAACM,GAAG;MACVZ,IAAI,EAAEM,CAAC,CAACN;IACV,CAAC,CAAC;EACJ;EAEA,oBACEhB,IAAA,CAACC,uBAAuB;IACtB4B,oCAAoC,EAClCpB,KAAK,CAACoB,oCACP;IACDnB,GAAG,EAAEC,SAAU;IAAA,GACXF,KAAK;IACTqB,YAAY,EAAEA,CAAA,KAAMrB,KAAK,CAACsB,OAAO,GAAG,CAAE;IACtCC,WAAW,EAAEA,CAAA,KAAMvB,KAAK,CAACwB,MAAM,GAAG,CAAE;IACpCV,YAAY,EAAEF,uBAAwB;IACtCK,iBAAiB,EAAED,4BAA6B;IAChDS,YAAY,EAAEjB;EAAiB,CAChC,CAAC;AAEN,CACF,CAAC;AAED,eAAeT,iBAAiB","ignoreList":[]}
|
|
@@ -8,12 +8,11 @@ import type { HostComponent } from 'react-native';
|
|
|
8
8
|
import type {
|
|
9
9
|
BubblingEventHandler,
|
|
10
10
|
Double,
|
|
11
|
-
|
|
12
|
-
import type {
|
|
11
|
+
WithDefault,
|
|
13
12
|
DirectEventHandler,
|
|
14
13
|
Float,
|
|
15
14
|
Int32,
|
|
16
|
-
} from 'react-native/Libraries/Types/
|
|
15
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
17
16
|
|
|
18
17
|
export interface OnChangeTextEvent {
|
|
19
18
|
value: string;
|
|
@@ -29,6 +28,7 @@ export interface onPasteImageEventData {
|
|
|
29
28
|
type: string;
|
|
30
29
|
fileName: string;
|
|
31
30
|
fileSize: Double;
|
|
31
|
+
source: 'keyboard' | 'clipboard' | 'context_menu';
|
|
32
32
|
error?: { message: string };
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -46,6 +46,10 @@ export interface TypeRichTextInputNativeProps extends ViewProps {
|
|
|
46
46
|
multiline?: boolean;
|
|
47
47
|
numberOfLines?: Int32;
|
|
48
48
|
secureTextEntry?: boolean;
|
|
49
|
+
keyboardAppearance?: WithDefault<'default' | 'light' | 'dark', 'default'>; // ios only
|
|
50
|
+
|
|
51
|
+
// Todo
|
|
52
|
+
// disableImagePasting?: boolean
|
|
49
53
|
|
|
50
54
|
// event callbacks
|
|
51
55
|
onInputFocus?: DirectEventHandler<null>;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
placeholder?: string;
|
|
8
|
-
placeholderTextColor?: ColorValue;
|
|
9
|
-
cursorColor?: ColorValue;
|
|
10
|
-
selectionColor?: ColorValue;
|
|
11
|
-
autoCapitalize?: string;
|
|
12
|
-
scrollEnabled?: boolean;
|
|
13
|
-
multiline?: boolean;
|
|
14
|
-
numberOfLines?: number;
|
|
15
|
-
secureTextEntry?: boolean;
|
|
1
|
+
import { type onPasteImageEventData, type TypeRichTextInputNativeProps } from './TypeRichTextInputNativeComponent';
|
|
2
|
+
type MaybeNativeEvent<T> = T | {
|
|
3
|
+
nativeEvent: T;
|
|
4
|
+
};
|
|
5
|
+
export declare function normalizeEvent<T>(event: MaybeNativeEvent<T>): T;
|
|
6
|
+
export interface TypeRichTextInputProps extends Omit<TypeRichTextInputNativeProps, 'onChangeText' | 'onChangeSelection' | 'onInputFocus' | 'onInputBlur' | 'onPasteImage'> {
|
|
16
7
|
onFocus?: () => void;
|
|
17
8
|
onBlur?: () => void;
|
|
18
9
|
onChangeText?: (value: string) => void;
|
|
19
|
-
onChangeSelection?: (
|
|
10
|
+
onChangeSelection?: (event: {
|
|
11
|
+
start: number;
|
|
12
|
+
end: number;
|
|
13
|
+
text: string;
|
|
14
|
+
}) => void;
|
|
20
15
|
onPasteImageData?: (data: onPasteImageEventData) => void;
|
|
21
|
-
color?: ColorValue;
|
|
22
|
-
fontSize?: number;
|
|
23
|
-
fontFamily?: string;
|
|
24
|
-
fontWeight?: string;
|
|
25
|
-
fontStyle?: string;
|
|
26
|
-
androidExperimentalSynchronousEvents?: boolean;
|
|
27
16
|
}
|
|
28
17
|
export interface TypeRichTextInputRef {
|
|
29
18
|
focus: () => void;
|
|
30
19
|
blur: () => void;
|
|
31
20
|
setValue: (text: string) => void;
|
|
32
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* TypeRichTextInput
|
|
24
|
+
*
|
|
25
|
+
* A high-performance rich text input component with:
|
|
26
|
+
* - image pasting support
|
|
27
|
+
* - Fabric-based rendering
|
|
28
|
+
* - custom ShadowNode on Android
|
|
29
|
+
*
|
|
30
|
+
* iOS support is currently unavailable and renders a `View` comp as fallback
|
|
31
|
+
* we are planning to add support for ios too soon
|
|
32
|
+
*/
|
|
33
33
|
declare const TypeRichTextInput: import("react").ForwardRefExoticComponent<TypeRichTextInputProps & import("react").RefAttributes<TypeRichTextInputRef>>;
|
|
34
34
|
export default TypeRichTextInput;
|
|
35
35
|
//# sourceMappingURL=TypeRichTextInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeRichTextInput.d.ts","sourceRoot":"","sources":["../../../src/TypeRichTextInput.tsx"],"names":[],"mappings":"
|
|
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,cAAc,GACd,aAAa,GACb,cAAc,CACjB;IAED,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC1B,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,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,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED;;;;;;;;;;GAUG;AACH,QAAA,MAAM,iBAAiB,yHA4EtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ColorValue } from 'react-native';
|
|
2
2
|
import { type ViewProps } from 'react-native';
|
|
3
3
|
import type { HostComponent } from 'react-native';
|
|
4
|
-
import type { BubblingEventHandler, Double } from 'react-native/Libraries/Types/CodegenTypes';
|
|
5
|
-
import type { DirectEventHandler, Float, Int32 } from 'react-native/Libraries/Types/CodegenTypesNamespace';
|
|
4
|
+
import type { BubblingEventHandler, Double, WithDefault, DirectEventHandler, Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
6
5
|
export interface OnChangeTextEvent {
|
|
7
6
|
value: string;
|
|
8
7
|
}
|
|
@@ -16,6 +15,7 @@ export interface onPasteImageEventData {
|
|
|
16
15
|
type: string;
|
|
17
16
|
fileName: string;
|
|
18
17
|
fileSize: Double;
|
|
18
|
+
source: 'keyboard' | 'clipboard' | 'context_menu';
|
|
19
19
|
error?: {
|
|
20
20
|
message: string;
|
|
21
21
|
};
|
|
@@ -33,6 +33,7 @@ export interface TypeRichTextInputNativeProps extends ViewProps {
|
|
|
33
33
|
multiline?: boolean;
|
|
34
34
|
numberOfLines?: Int32;
|
|
35
35
|
secureTextEntry?: boolean;
|
|
36
|
+
keyboardAppearance?: WithDefault<'default' | 'light' | 'dark', 'default'>;
|
|
36
37
|
onInputFocus?: DirectEventHandler<null>;
|
|
37
38
|
onInputBlur?: DirectEventHandler<null>;
|
|
38
39
|
onChangeText?: DirectEventHandler<OnChangeTextEvent>;
|
|
@@ -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,
|
|
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,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,WAAW,CAAC,SAAS,GAAG,OAAO,GAAG,MAAM,EAAE,SAAS,CAAC,CAAC;IAM1E,YAAY,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACxC,WAAW,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACvC,YAAY,CAAC,EAAE,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;IACrD,iBAAiB,CAAC,EAAE,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;IAC/D,YAAY,CAAC,EAAE,oBAAoB,CAAC,qBAAqB,CAAC,CAAC;IAI3D,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,oCAAoC,CAAC,EAAE,OAAO,CAAC;CAChD;AAED,KAAK,aAAa,GAAG,aAAa,CAAC,4BAA4B,CAAC,CAAC;AAEjE,UAAU,cAAc;IAEtB,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IAC1D,IAAI,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IACzD,QAAQ,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5E;AAED,eAAO,MAAM,QAAQ,EAAE,cAOrB,CAAC;wBAOE,aAAa,CAAC,4BAA4B,CAAC;AALhD,wBAKiD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as TypeRichTextInput } from './TypeRichTextInput';
|
|
2
2
|
export * from './TypeRichTextInput';
|
|
3
|
-
export type { OnChangeTextEvent, OnChangeSelectionEvent, } from './TypeRichTextInputNativeComponent';
|
|
3
|
+
export type { OnChangeTextEvent, OnChangeSelectionEvent, onPasteImageEventData, } from './TypeRichTextInputNativeComponent';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,cAAc,qBAAqB,CAAC;AACpC,YAAY,EACV,iBAAiB,EACjB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,cAAc,qBAAqB,CAAC;AACpC,YAAY,EACV,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-typerich",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Textinput replacement",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -43,7 +43,12 @@
|
|
|
43
43
|
"keywords": [
|
|
44
44
|
"react-native",
|
|
45
45
|
"ios",
|
|
46
|
-
"android"
|
|
46
|
+
"android",
|
|
47
|
+
"rich text input",
|
|
48
|
+
"image pasting",
|
|
49
|
+
"gboard stickers",
|
|
50
|
+
"live markdown",
|
|
51
|
+
"markdown textinput"
|
|
47
52
|
],
|
|
48
53
|
"repository": {
|
|
49
54
|
"type": "git",
|
|
@@ -96,7 +101,6 @@
|
|
|
96
101
|
"source": "src",
|
|
97
102
|
"output": "lib",
|
|
98
103
|
"targets": [
|
|
99
|
-
"codegen",
|
|
100
104
|
[
|
|
101
105
|
"module",
|
|
102
106
|
{
|
|
@@ -1,43 +1,54 @@
|
|
|
1
1
|
import { forwardRef, useImperativeHandle, useRef, type Ref } from 'react';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { NativeSyntheticEvent } from 'react-native';
|
|
4
|
+
import { Platform, View } from 'react-native';
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
+
import {
|
|
6
7
|
Commands,
|
|
8
|
+
type OnChangeSelectionEvent,
|
|
9
|
+
type OnChangeTextEvent,
|
|
7
10
|
type onPasteImageEventData,
|
|
11
|
+
type TypeRichTextInputNativeProps,
|
|
8
12
|
} from './TypeRichTextInputNativeComponent';
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
scrollEnabled?: boolean;
|
|
21
|
-
multiline?: boolean;
|
|
22
|
-
numberOfLines?: number;
|
|
23
|
-
secureTextEntry?: boolean;
|
|
14
|
+
let NativeTypeRichTextInput: any;
|
|
15
|
+
|
|
16
|
+
if (Platform.OS === 'android') {
|
|
17
|
+
NativeTypeRichTextInput =
|
|
18
|
+
require('./TypeRichTextInputNativeComponent').default;
|
|
19
|
+
} else {
|
|
20
|
+
// iOS fallback (temporary)
|
|
21
|
+
NativeTypeRichTextInput = View;
|
|
22
|
+
}
|
|
23
|
+
type MaybeNativeEvent<T> = T | { nativeEvent: T };
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
export function normalizeEvent<T>(event: MaybeNativeEvent<T>): T {
|
|
26
|
+
if (event && typeof event === 'object' && 'nativeEvent' in event) {
|
|
27
|
+
return (event as { nativeEvent: T }).nativeEvent;
|
|
28
|
+
}
|
|
29
|
+
return event as T;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Public facing props (same as NativeProps but events normalized)
|
|
33
|
+
export interface TypeRichTextInputProps
|
|
34
|
+
extends Omit<
|
|
35
|
+
TypeRichTextInputNativeProps,
|
|
36
|
+
| 'onChangeText'
|
|
37
|
+
| 'onChangeSelection'
|
|
38
|
+
| 'onInputFocus'
|
|
39
|
+
| 'onInputBlur'
|
|
40
|
+
| 'onPasteImage'
|
|
41
|
+
> {
|
|
42
|
+
// JS-friendly callbacks
|
|
26
43
|
onFocus?: () => void;
|
|
27
44
|
onBlur?: () => void;
|
|
28
45
|
onChangeText?: (value: string) => void;
|
|
29
|
-
onChangeSelection?: (
|
|
46
|
+
onChangeSelection?: (event: {
|
|
47
|
+
start: number;
|
|
48
|
+
end: number;
|
|
49
|
+
text: string;
|
|
50
|
+
}) => void;
|
|
30
51
|
onPasteImageData?: (data: onPasteImageEventData) => void;
|
|
31
|
-
|
|
32
|
-
// style props
|
|
33
|
-
color?: ColorValue;
|
|
34
|
-
fontSize?: number;
|
|
35
|
-
fontFamily?: string;
|
|
36
|
-
fontWeight?: string;
|
|
37
|
-
fontStyle?: string;
|
|
38
|
-
|
|
39
|
-
// other
|
|
40
|
-
androidExperimentalSynchronousEvents?: boolean;
|
|
41
52
|
}
|
|
42
53
|
|
|
43
54
|
export interface TypeRichTextInputRef {
|
|
@@ -46,6 +57,17 @@ export interface TypeRichTextInputRef {
|
|
|
46
57
|
setValue: (text: string) => void;
|
|
47
58
|
}
|
|
48
59
|
|
|
60
|
+
/**
|
|
61
|
+
* TypeRichTextInput
|
|
62
|
+
*
|
|
63
|
+
* A high-performance rich text input component with:
|
|
64
|
+
* - image pasting support
|
|
65
|
+
* - Fabric-based rendering
|
|
66
|
+
* - custom ShadowNode on Android
|
|
67
|
+
*
|
|
68
|
+
* iOS support is currently unavailable and renders a `View` comp as fallback
|
|
69
|
+
* we are planning to add support for ios too soon
|
|
70
|
+
*/
|
|
49
71
|
const TypeRichTextInput = forwardRef(
|
|
50
72
|
(props: TypeRichTextInputProps, ref: Ref<TypeRichTextInputRef>) => {
|
|
51
73
|
const nativeRef = useRef(null);
|
|
@@ -89,6 +111,24 @@ const TypeRichTextInput = forwardRef(
|
|
|
89
111
|
}
|
|
90
112
|
}
|
|
91
113
|
|
|
114
|
+
function handleOnChangeTextEvent(
|
|
115
|
+
event: OnChangeTextEvent | { nativeEvent: OnChangeTextEvent }
|
|
116
|
+
) {
|
|
117
|
+
const e = normalizeEvent(event);
|
|
118
|
+
props.onChangeText?.(e.value);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function handleonChangeSelectionEvent(
|
|
122
|
+
event: OnChangeSelectionEvent | { nativeEvent: OnChangeSelectionEvent }
|
|
123
|
+
) {
|
|
124
|
+
const e = normalizeEvent(event);
|
|
125
|
+
props.onChangeSelection?.({
|
|
126
|
+
start: e.start,
|
|
127
|
+
end: e.end,
|
|
128
|
+
text: e.text,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
92
132
|
return (
|
|
93
133
|
<NativeTypeRichTextInput
|
|
94
134
|
androidExperimentalSynchronousEvents={
|
|
@@ -98,14 +138,8 @@ const TypeRichTextInput = forwardRef(
|
|
|
98
138
|
{...props}
|
|
99
139
|
onInputFocus={() => props.onFocus?.()}
|
|
100
140
|
onInputBlur={() => props.onBlur?.()}
|
|
101
|
-
onChangeText={
|
|
102
|
-
onChangeSelection={
|
|
103
|
-
props.onChangeSelection?.(
|
|
104
|
-
event.nativeEvent.start,
|
|
105
|
-
event.nativeEvent.end,
|
|
106
|
-
event.nativeEvent.text
|
|
107
|
-
)
|
|
108
|
-
}
|
|
141
|
+
onChangeText={handleOnChangeTextEvent}
|
|
142
|
+
onChangeSelection={handleonChangeSelectionEvent}
|
|
109
143
|
onPasteImage={handlePasteImage}
|
|
110
144
|
/>
|
|
111
145
|
);
|
|
@@ -8,12 +8,11 @@ import type { HostComponent } from 'react-native';
|
|
|
8
8
|
import type {
|
|
9
9
|
BubblingEventHandler,
|
|
10
10
|
Double,
|
|
11
|
-
|
|
12
|
-
import type {
|
|
11
|
+
WithDefault,
|
|
13
12
|
DirectEventHandler,
|
|
14
13
|
Float,
|
|
15
14
|
Int32,
|
|
16
|
-
} from 'react-native/Libraries/Types/
|
|
15
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
17
16
|
|
|
18
17
|
export interface OnChangeTextEvent {
|
|
19
18
|
value: string;
|
|
@@ -29,6 +28,7 @@ export interface onPasteImageEventData {
|
|
|
29
28
|
type: string;
|
|
30
29
|
fileName: string;
|
|
31
30
|
fileSize: Double;
|
|
31
|
+
source: 'keyboard' | 'clipboard' | 'context_menu';
|
|
32
32
|
error?: { message: string };
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -46,6 +46,10 @@ export interface TypeRichTextInputNativeProps extends ViewProps {
|
|
|
46
46
|
multiline?: boolean;
|
|
47
47
|
numberOfLines?: Int32;
|
|
48
48
|
secureTextEntry?: boolean;
|
|
49
|
+
keyboardAppearance?: WithDefault<'default' | 'light' | 'dark', 'default'>; // ios only
|
|
50
|
+
|
|
51
|
+
// Todo
|
|
52
|
+
// disableImagePasting?: boolean
|
|
49
53
|
|
|
50
54
|
// event callbacks
|
|
51
55
|
onInputFocus?: DirectEventHandler<null>;
|
package/src/index.tsx
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
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/TypeRichTextInputViewSpec/ComponentDescriptors.h>
|
|
12
|
-
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
13
|
-
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
14
|
-
|
|
15
|
-
namespace facebook::react {
|
|
16
|
-
|
|
17
|
-
void TypeRichTextInputViewSpec_registerComponentDescriptorsFromCodegen(
|
|
18
|
-
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
} // namespace facebook::react
|
|
@@ -1,24 +0,0 @@
|
|
|
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/TypeRichTextInputViewSpec/ShadowNodes.h>
|
|
14
|
-
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
-
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
16
|
-
|
|
17
|
-
namespace facebook::react {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
void TypeRichTextInputViewSpec_registerComponentDescriptorsFromCodegen(
|
|
22
|
-
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
23
|
-
|
|
24
|
-
} // namespace facebook::react
|
|
@@ -1,70 +0,0 @@
|
|
|
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/TypeRichTextInputViewSpec/EventEmitters.h>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
namespace facebook::react {
|
|
15
|
-
|
|
16
|
-
void TypeRichTextInputViewEventEmitter::onInputFocus(OnInputFocus event) const {
|
|
17
|
-
dispatchEvent("inputFocus", [](jsi::Runtime &runtime) {
|
|
18
|
-
auto payload = jsi::Object(runtime);
|
|
19
|
-
|
|
20
|
-
return payload;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
void TypeRichTextInputViewEventEmitter::onInputBlur(OnInputBlur event) const {
|
|
26
|
-
dispatchEvent("inputBlur", [](jsi::Runtime &runtime) {
|
|
27
|
-
auto payload = jsi::Object(runtime);
|
|
28
|
-
|
|
29
|
-
return payload;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
void TypeRichTextInputViewEventEmitter::onChangeText(OnChangeText event) const {
|
|
35
|
-
dispatchEvent("changeText", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
36
|
-
auto payload = jsi::Object(runtime);
|
|
37
|
-
payload.setProperty(runtime, "value", event.value);
|
|
38
|
-
return payload;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
void TypeRichTextInputViewEventEmitter::onChangeSelection(OnChangeSelection event) const {
|
|
44
|
-
dispatchEvent("changeSelection", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
45
|
-
auto payload = jsi::Object(runtime);
|
|
46
|
-
payload.setProperty(runtime, "start", event.start);
|
|
47
|
-
payload.setProperty(runtime, "end", event.end);
|
|
48
|
-
payload.setProperty(runtime, "text", event.text);
|
|
49
|
-
return payload;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
void TypeRichTextInputViewEventEmitter::onPasteImage(OnPasteImage event) const {
|
|
55
|
-
dispatchEvent("pasteImage", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
56
|
-
auto payload = jsi::Object(runtime);
|
|
57
|
-
payload.setProperty(runtime, "uri", event.uri);
|
|
58
|
-
payload.setProperty(runtime, "type", event.type);
|
|
59
|
-
payload.setProperty(runtime, "fileName", event.fileName);
|
|
60
|
-
payload.setProperty(runtime, "fileSize", event.fileSize);
|
|
61
|
-
{
|
|
62
|
-
auto error = jsi::Object(runtime);
|
|
63
|
-
error.setProperty(runtime, "message", event.error.message);
|
|
64
|
-
payload.setProperty(runtime, "error", error);
|
|
65
|
-
}
|
|
66
|
-
return payload;
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
} // namespace facebook::react
|
|
@@ -1,59 +0,0 @@
|
|
|
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 TypeRichTextInputViewEventEmitter : public ViewEventEmitter {
|
|
17
|
-
public:
|
|
18
|
-
using ViewEventEmitter::ViewEventEmitter;
|
|
19
|
-
|
|
20
|
-
struct OnInputFocus {
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
struct OnInputBlur {
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
struct OnChangeText {
|
|
29
|
-
std::string value;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
struct OnChangeSelection {
|
|
33
|
-
int start;
|
|
34
|
-
int end;
|
|
35
|
-
std::string text;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
struct OnPasteImageError {
|
|
39
|
-
std::string message;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
struct OnPasteImage {
|
|
43
|
-
std::string uri;
|
|
44
|
-
std::string type;
|
|
45
|
-
std::string fileName;
|
|
46
|
-
double fileSize;
|
|
47
|
-
OnPasteImageError error;
|
|
48
|
-
};
|
|
49
|
-
void onInputFocus(OnInputFocus value) const;
|
|
50
|
-
|
|
51
|
-
void onInputBlur(OnInputBlur value) const;
|
|
52
|
-
|
|
53
|
-
void onChangeText(OnChangeText value) const;
|
|
54
|
-
|
|
55
|
-
void onChangeSelection(OnChangeSelection value) const;
|
|
56
|
-
|
|
57
|
-
void onPasteImage(OnPasteImage value) const;
|
|
58
|
-
};
|
|
59
|
-
} // namespace facebook::react
|
|
@@ -1,132 +0,0 @@
|
|
|
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/TypeRichTextInputViewSpec/Props.h>
|
|
12
|
-
#include <react/renderer/core/PropsParserContext.h>
|
|
13
|
-
#include <react/renderer/core/propsConversions.h>
|
|
14
|
-
|
|
15
|
-
namespace facebook::react {
|
|
16
|
-
|
|
17
|
-
TypeRichTextInputViewProps::TypeRichTextInputViewProps(
|
|
18
|
-
const PropsParserContext &context,
|
|
19
|
-
const TypeRichTextInputViewProps &sourceProps,
|
|
20
|
-
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
21
|
-
|
|
22
|
-
autoFocus(convertRawProp(context, rawProps, "autoFocus", sourceProps.autoFocus, {false})),
|
|
23
|
-
editable(convertRawProp(context, rawProps, "editable", sourceProps.editable, {false})),
|
|
24
|
-
defaultValue(convertRawProp(context, rawProps, "defaultValue", sourceProps.defaultValue, {})),
|
|
25
|
-
placeholder(convertRawProp(context, rawProps, "placeholder", sourceProps.placeholder, {})),
|
|
26
|
-
placeholderTextColor(convertRawProp(context, rawProps, "placeholderTextColor", sourceProps.placeholderTextColor, {})),
|
|
27
|
-
cursorColor(convertRawProp(context, rawProps, "cursorColor", sourceProps.cursorColor, {})),
|
|
28
|
-
selectionColor(convertRawProp(context, rawProps, "selectionColor", sourceProps.selectionColor, {})),
|
|
29
|
-
autoCapitalize(convertRawProp(context, rawProps, "autoCapitalize", sourceProps.autoCapitalize, {})),
|
|
30
|
-
scrollEnabled(convertRawProp(context, rawProps, "scrollEnabled", sourceProps.scrollEnabled, {false})),
|
|
31
|
-
multiline(convertRawProp(context, rawProps, "multiline", sourceProps.multiline, {false})),
|
|
32
|
-
numberOfLines(convertRawProp(context, rawProps, "numberOfLines", sourceProps.numberOfLines, {0})),
|
|
33
|
-
secureTextEntry(convertRawProp(context, rawProps, "secureTextEntry", sourceProps.secureTextEntry, {false})),
|
|
34
|
-
color(convertRawProp(context, rawProps, "color", sourceProps.color, {})),
|
|
35
|
-
fontSize(convertRawProp(context, rawProps, "fontSize", sourceProps.fontSize, {0.0})),
|
|
36
|
-
fontFamily(convertRawProp(context, rawProps, "fontFamily", sourceProps.fontFamily, {})),
|
|
37
|
-
fontWeight(convertRawProp(context, rawProps, "fontWeight", sourceProps.fontWeight, {})),
|
|
38
|
-
fontStyle(convertRawProp(context, rawProps, "fontStyle", sourceProps.fontStyle, {})),
|
|
39
|
-
androidExperimentalSynchronousEvents(convertRawProp(context, rawProps, "androidExperimentalSynchronousEvents", sourceProps.androidExperimentalSynchronousEvents, {false})) {}
|
|
40
|
-
|
|
41
|
-
#ifdef RN_SERIALIZABLE_STATE
|
|
42
|
-
ComponentName TypeRichTextInputViewProps::getDiffPropsImplementationTarget() const {
|
|
43
|
-
return "TypeRichTextInputView";
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
folly::dynamic TypeRichTextInputViewProps::getDiffProps(
|
|
47
|
-
const Props* prevProps) const {
|
|
48
|
-
static const auto defaultProps = TypeRichTextInputViewProps();
|
|
49
|
-
const TypeRichTextInputViewProps* oldProps = prevProps == nullptr
|
|
50
|
-
? &defaultProps
|
|
51
|
-
: static_cast<const TypeRichTextInputViewProps*>(prevProps);
|
|
52
|
-
if (this == oldProps) {
|
|
53
|
-
return folly::dynamic::object();
|
|
54
|
-
}
|
|
55
|
-
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
|
56
|
-
|
|
57
|
-
if (autoFocus != oldProps->autoFocus) {
|
|
58
|
-
result["autoFocus"] = autoFocus;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (editable != oldProps->editable) {
|
|
62
|
-
result["editable"] = editable;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (defaultValue != oldProps->defaultValue) {
|
|
66
|
-
result["defaultValue"] = defaultValue;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (placeholder != oldProps->placeholder) {
|
|
70
|
-
result["placeholder"] = placeholder;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (placeholderTextColor != oldProps->placeholderTextColor) {
|
|
74
|
-
result["placeholderTextColor"] = *placeholderTextColor;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (cursorColor != oldProps->cursorColor) {
|
|
78
|
-
result["cursorColor"] = *cursorColor;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (selectionColor != oldProps->selectionColor) {
|
|
82
|
-
result["selectionColor"] = *selectionColor;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (autoCapitalize != oldProps->autoCapitalize) {
|
|
86
|
-
result["autoCapitalize"] = autoCapitalize;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (scrollEnabled != oldProps->scrollEnabled) {
|
|
90
|
-
result["scrollEnabled"] = scrollEnabled;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (multiline != oldProps->multiline) {
|
|
94
|
-
result["multiline"] = multiline;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (numberOfLines != oldProps->numberOfLines) {
|
|
98
|
-
result["numberOfLines"] = numberOfLines;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (secureTextEntry != oldProps->secureTextEntry) {
|
|
102
|
-
result["secureTextEntry"] = secureTextEntry;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (color != oldProps->color) {
|
|
106
|
-
result["color"] = *color;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if ((fontSize != oldProps->fontSize) && !(std::isnan(fontSize) && std::isnan(oldProps->fontSize))) {
|
|
110
|
-
result["fontSize"] = fontSize;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (fontFamily != oldProps->fontFamily) {
|
|
114
|
-
result["fontFamily"] = fontFamily;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (fontWeight != oldProps->fontWeight) {
|
|
118
|
-
result["fontWeight"] = fontWeight;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (fontStyle != oldProps->fontStyle) {
|
|
122
|
-
result["fontStyle"] = fontStyle;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (androidExperimentalSynchronousEvents != oldProps->androidExperimentalSynchronousEvents) {
|
|
126
|
-
result["androidExperimentalSynchronousEvents"] = androidExperimentalSynchronousEvents;
|
|
127
|
-
}
|
|
128
|
-
return result;
|
|
129
|
-
}
|
|
130
|
-
#endif
|
|
131
|
-
|
|
132
|
-
} // namespace facebook::react
|
|
@@ -1,51 +0,0 @@
|
|
|
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: GeneratePropsH.js
|
|
9
|
-
*/
|
|
10
|
-
#pragma once
|
|
11
|
-
|
|
12
|
-
#include <react/renderer/components/view/ViewProps.h>
|
|
13
|
-
#include <react/renderer/core/PropsParserContext.h>
|
|
14
|
-
#include <react/renderer/graphics/Color.h>
|
|
15
|
-
|
|
16
|
-
namespace facebook::react {
|
|
17
|
-
|
|
18
|
-
class TypeRichTextInputViewProps final : public ViewProps {
|
|
19
|
-
public:
|
|
20
|
-
TypeRichTextInputViewProps() = default;
|
|
21
|
-
TypeRichTextInputViewProps(const PropsParserContext& context, const TypeRichTextInputViewProps &sourceProps, const RawProps &rawProps);
|
|
22
|
-
|
|
23
|
-
#pragma mark - Props
|
|
24
|
-
|
|
25
|
-
bool autoFocus{false};
|
|
26
|
-
bool editable{false};
|
|
27
|
-
std::string defaultValue{};
|
|
28
|
-
std::string placeholder{};
|
|
29
|
-
SharedColor placeholderTextColor{};
|
|
30
|
-
SharedColor cursorColor{};
|
|
31
|
-
SharedColor selectionColor{};
|
|
32
|
-
std::string autoCapitalize{};
|
|
33
|
-
bool scrollEnabled{false};
|
|
34
|
-
bool multiline{false};
|
|
35
|
-
int numberOfLines{0};
|
|
36
|
-
bool secureTextEntry{false};
|
|
37
|
-
SharedColor color{};
|
|
38
|
-
Float fontSize{0.0};
|
|
39
|
-
std::string fontFamily{};
|
|
40
|
-
std::string fontWeight{};
|
|
41
|
-
std::string fontStyle{};
|
|
42
|
-
bool androidExperimentalSynchronousEvents{false};
|
|
43
|
-
|
|
44
|
-
#ifdef RN_SERIALIZABLE_STATE
|
|
45
|
-
ComponentName getDiffPropsImplementationTarget() const override;
|
|
46
|
-
|
|
47
|
-
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
|
48
|
-
#endif
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
} // namespace facebook::react
|
|
@@ -1,80 +0,0 @@
|
|
|
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 RCTTypeRichTextInputViewViewProtocol <NSObject>
|
|
17
|
-
- (void)focus;
|
|
18
|
-
- (void)blur;
|
|
19
|
-
- (void)setValue:(NSString *)text;
|
|
20
|
-
@end
|
|
21
|
-
|
|
22
|
-
RCT_EXTERN inline void RCTTypeRichTextInputViewHandleCommand(
|
|
23
|
-
id<RCTTypeRichTextInputViewViewProtocol> componentView,
|
|
24
|
-
NSString const *commandName,
|
|
25
|
-
NSArray const *args)
|
|
26
|
-
{
|
|
27
|
-
if ([commandName isEqualToString:@"focus"]) {
|
|
28
|
-
#if RCT_DEBUG
|
|
29
|
-
if ([args count] != 0) {
|
|
30
|
-
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"TypeRichTextInputView", commandName, (int)[args count], 0);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
#endif
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
[componentView focus];
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if ([commandName isEqualToString:@"blur"]) {
|
|
42
|
-
#if RCT_DEBUG
|
|
43
|
-
if ([args count] != 0) {
|
|
44
|
-
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"TypeRichTextInputView", commandName, (int)[args count], 0);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
#endif
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
[componentView blur];
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if ([commandName isEqualToString:@"setValue"]) {
|
|
56
|
-
#if RCT_DEBUG
|
|
57
|
-
if ([args count] != 1) {
|
|
58
|
-
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"TypeRichTextInputView", commandName, (int)[args count], 1);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
#endif
|
|
62
|
-
|
|
63
|
-
NSObject *arg0 = args[0];
|
|
64
|
-
#if RCT_DEBUG
|
|
65
|
-
if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSString class], @"string", @"TypeRichTextInputView", commandName, @"1st")) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
#endif
|
|
69
|
-
NSString * text = (NSString *)arg0;
|
|
70
|
-
|
|
71
|
-
[componentView setValue:text];
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
#if RCT_DEBUG
|
|
76
|
-
RCTLogError(@"%@ received command %@, which is not a supported command.", @"TypeRichTextInputView", commandName);
|
|
77
|
-
#endif
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
NS_ASSUME_NONNULL_END
|
|
@@ -1,17 +0,0 @@
|
|
|
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/TypeRichTextInputViewSpec/ShadowNodes.h>
|
|
12
|
-
|
|
13
|
-
namespace facebook::react {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} // namespace facebook::react
|
|
@@ -1,23 +0,0 @@
|
|
|
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/TypeRichTextInputViewSpec/EventEmitters.h>
|
|
14
|
-
#include <react/renderer/components/TypeRichTextInputViewSpec/Props.h>
|
|
15
|
-
#include <react/renderer/components/TypeRichTextInputViewSpec/States.h>
|
|
16
|
-
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
-
#include <jsi/jsi.h>
|
|
18
|
-
|
|
19
|
-
namespace facebook::react {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} // namespace facebook::react
|
|
@@ -1,16 +0,0 @@
|
|
|
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/TypeRichTextInputViewSpec/States.h>
|
|
11
|
-
|
|
12
|
-
namespace facebook::react {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} // namespace facebook::react
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
} // namespace facebook::react
|