react-native-typerich 0.1.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 +28 -0
- package/README.md +37 -0
- package/TypeRichTextInput.podspec +20 -0
- package/android/build.gradle +99 -0
- package/android/generated/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TypeRichTextInputViewManagerDelegate.java +100 -0
- package/android/generated/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TypeRichTextInputViewManagerInterface.java +38 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/TypeRichTextInputViewSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/TypeRichTextInputViewSpec/ComponentDescriptors.h +24 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/TypeRichTextInputViewSpec/EventEmitters.cpp +70 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/TypeRichTextInputViewSpec/EventEmitters.h +59 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/TypeRichTextInputViewSpec/Props.cpp +132 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/TypeRichTextInputViewSpec/Props.h +51 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/TypeRichTextInputViewSpec/ShadowNodes.cpp +17 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/TypeRichTextInputViewSpec/ShadowNodes.h +23 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/TypeRichTextInputViewSpec/States.cpp +16 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/TypeRichTextInputViewSpec/States.h +20 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/typerich/MeasurementStore.kt +148 -0
- package/android/src/main/java/com/typerich/TypeRichTextInputView.kt +503 -0
- package/android/src/main/java/com/typerich/TypeRichTextInputViewLayoutManager.kt +30 -0
- package/android/src/main/java/com/typerich/TypeRichTextInputViewManager.kt +188 -0
- package/android/src/main/java/com/typerich/TypeRichTextInputViewPackage.kt +19 -0
- package/android/src/main/java/com/typerich/events/OnChangeSelectionEvent.kt +29 -0
- package/android/src/main/java/com/typerich/events/OnChangeTextEvent.kt +35 -0
- package/android/src/main/java/com/typerich/events/OnInputBlurEvent.kt +27 -0
- package/android/src/main/java/com/typerich/events/OnInputFocusEvent.kt +27 -0
- package/android/src/main/java/com/typerich/events/OnPasteImageEvent.kt +45 -0
- package/android/src/main/new_arch/CMakeLists.txt +73 -0
- package/android/src/main/new_arch/TypeRichTextInputViewSpec.cpp +22 -0
- package/android/src/main/new_arch/TypeRichTextInputViewSpec.h +26 -0
- package/android/src/main/new_arch/react/renderer/components/TypeRichTextInputView/TypeRichTextInputViewComponentDescriptor.h +36 -0
- package/android/src/main/new_arch/react/renderer/components/TypeRichTextInputView/TypeRichTextInputViewMeasurementManager.cpp +83 -0
- package/android/src/main/new_arch/react/renderer/components/TypeRichTextInputView/TypeRichTextInputViewMeasurementManager.h +25 -0
- package/android/src/main/new_arch/react/renderer/components/TypeRichTextInputView/TypeRichTextInputViewShadowNode.cpp +132 -0
- package/android/src/main/new_arch/react/renderer/components/TypeRichTextInputView/TypeRichTextInputViewShadowNode.h +54 -0
- package/android/src/main/new_arch/react/renderer/components/TypeRichTextInputView/TypeRichTextInputViewState.cpp +9 -0
- package/android/src/main/new_arch/react/renderer/components/TypeRichTextInputView/TypeRichTextInputViewState.h +28 -0
- package/android/src/main/new_arch/react/renderer/components/TypeRichTextInputView/conversions.h +21 -0
- package/ios/TypeRichTextInputView.h +14 -0
- package/ios/TypeRichTextInputView.mm +71 -0
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/EventEmitters.cpp +70 -0
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/EventEmitters.h +59 -0
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/Props.cpp +132 -0
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/Props.h +51 -0
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/RCTComponentViewHelpers.h +80 -0
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/ShadowNodes.h +23 -0
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/States.cpp +16 -0
- package/ios/generated/build/generated/ios/react/renderer/components/TypeRichTextInputViewSpec/States.h +20 -0
- package/lib/module/TypeRichTextInput.js +50 -0
- package/lib/module/TypeRichTextInput.js.map +1 -0
- package/lib/module/TypeRichTextInputNativeComponent.ts +92 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types/react-native-codegen.d.js +2 -0
- package/lib/module/types/react-native-codegen.d.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/TypeRichTextInput.d.ts +35 -0
- package/lib/typescript/src/TypeRichTextInput.d.ts.map +1 -0
- package/lib/typescript/src/TypeRichTextInputNativeComponent.d.ts +57 -0
- package/lib/typescript/src/TypeRichTextInputNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +180 -0
- package/react-native.config.js +13 -0
- package/src/TypeRichTextInput.tsx +115 -0
- package/src/TypeRichTextInputNativeComponent.ts +92 -0
- package/src/index.tsx +6 -0
- package/src/types/react-native-codegen.d.ts +11 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useImperativeHandle","useRef","NativeTypeRichTextInput","Commands","jsx","_jsx","TypeRichTextInput","props","ref","nativeRef","focus","current","blur","setValue","text","handlePasteImage","event","data","nativeEvent","undefined","onPasteImageData","androidExperimentalSynchronousEvents","onInputFocus","onFocus","onInputBlur","onBlur","onChangeText","value","onChangeSelection","start","end","onPasteImage"],"sourceRoot":"../../src","sources":["TypeRichTextInput.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,mBAAmB,EAAEC,MAAM,QAAkB,OAAO;AAIzE,OAAOC,uBAAuB,IAC5BC,QAAQ,QAEH,oCAAoC;;AAE3C;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAuCA,MAAMC,iBAAiB,gBAAGP,UAAU,CAClC,CAACQ,KAA6B,EAAEC,GAA8B,KAAK;EACjE,MAAMC,SAAS,GAAGR,MAAM,CAAC,IAAI,CAAC;EAE9BD,mBAAmB,CAACQ,GAAG,EAAE,OAAO;IAC9BE,KAAK,EAAEA,CAAA,KAAM;MACX,IAAID,SAAS,CAACE,OAAO,EAAE;QACrBR,QAAQ,CAACO,KAAK,CAACD,SAAS,CAACE,OAAO,CAAC;MACnC;IACF,CAAC;IACDC,IAAI,EAAEA,CAAA,KAAM;MACV,IAAIH,SAAS,CAACE,OAAO,EAAE;QACrBR,QAAQ,CAACS,IAAI,CAACH,SAAS,CAACE,OAAO,CAAC;MAClC;IACF,CAAC;IACDE,QAAQ,EAAGC,IAAY,IAAK;MAC1B,IAAIL,SAAS,CAACE,OAAO,EAAE;QACrBR,QAAQ,CAACU,QAAQ,CAACJ,SAAS,CAACE,OAAO,EAAEG,IAAI,CAAC;MAC5C;IACF;EACF,CAAC,CAAC,CAAC;;EAEH;AACJ;AACA;EACI,SAASC,gBAAgBA,CACvBC,KAIO,EACD;IACN;IACA,MAAMC,IAAuC,GAC3CD,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,GAC9BA,KAAK,CAACE,WAAW,IAAIF,KAAK,GAC1BG,SAAS;IAEf,IAAIF,IAAI,EAAE;MACRV,KAAK,CAACa,gBAAgB,GAAGH,IAA6B,CAAC;IACzD;EACF;EAEA,oBACEZ,IAAA,CAACH,uBAAuB;IACtBmB,oCAAoC,EAClCd,KAAK,CAACc,oCACP;IACDb,GAAG,EAAEC,SAAU;IAAA,GACXF,KAAK;IACTe,YAAY,EAAEA,CAAA,KAAMf,KAAK,CAACgB,OAAO,GAAG,CAAE;IACtCC,WAAW,EAAEA,CAAA,KAAMjB,KAAK,CAACkB,MAAM,GAAG,CAAE;IACpCC,YAAY,EAAGV,KAAK,IAAKT,KAAK,CAACmB,YAAY,GAAGV,KAAK,CAACE,WAAW,CAACS,KAAK,CAAE;IACvEC,iBAAiB,EAAGZ,KAAK,IACvBT,KAAK,CAACqB,iBAAiB,GACrBZ,KAAK,CAACE,WAAW,CAACW,KAAK,EACvBb,KAAK,CAACE,WAAW,CAACY,GAAG,EACrBd,KAAK,CAACE,WAAW,CAACJ,IACpB,CACD;IACDiB,YAAY,EAAEhB;EAAiB,CAChC,CAAC;AAEN,CACF,CAAC;AAED,eAAeT,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { ColorValue } from 'react-native';
|
|
2
|
+
import {
|
|
3
|
+
codegenNativeComponent,
|
|
4
|
+
codegenNativeCommands,
|
|
5
|
+
type ViewProps,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
import type { HostComponent } from 'react-native';
|
|
8
|
+
import type {
|
|
9
|
+
BubblingEventHandler,
|
|
10
|
+
Double,
|
|
11
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
12
|
+
import type {
|
|
13
|
+
DirectEventHandler,
|
|
14
|
+
Float,
|
|
15
|
+
Int32,
|
|
16
|
+
} from 'react-native/Libraries/Types/CodegenTypesNamespace';
|
|
17
|
+
|
|
18
|
+
export interface OnChangeTextEvent {
|
|
19
|
+
value: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface OnChangeSelectionEvent {
|
|
23
|
+
start: Int32;
|
|
24
|
+
end: Int32;
|
|
25
|
+
text: string;
|
|
26
|
+
}
|
|
27
|
+
export interface onPasteImageEventData {
|
|
28
|
+
uri: string;
|
|
29
|
+
type: string;
|
|
30
|
+
fileName: string;
|
|
31
|
+
fileSize: Double;
|
|
32
|
+
error?: { message: string };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface TypeRichTextInputNativeProps extends ViewProps {
|
|
36
|
+
// base props
|
|
37
|
+
autoFocus?: boolean;
|
|
38
|
+
editable?: boolean;
|
|
39
|
+
defaultValue?: string;
|
|
40
|
+
placeholder?: string;
|
|
41
|
+
placeholderTextColor?: ColorValue;
|
|
42
|
+
cursorColor?: ColorValue;
|
|
43
|
+
selectionColor?: ColorValue;
|
|
44
|
+
autoCapitalize?: string;
|
|
45
|
+
scrollEnabled?: boolean;
|
|
46
|
+
multiline?: boolean;
|
|
47
|
+
numberOfLines?: Int32;
|
|
48
|
+
secureTextEntry?: boolean;
|
|
49
|
+
|
|
50
|
+
// event callbacks
|
|
51
|
+
onInputFocus?: DirectEventHandler<null>;
|
|
52
|
+
onInputBlur?: DirectEventHandler<null>;
|
|
53
|
+
onChangeText?: DirectEventHandler<OnChangeTextEvent>;
|
|
54
|
+
onChangeSelection?: DirectEventHandler<OnChangeSelectionEvent>;
|
|
55
|
+
onPasteImage?: BubblingEventHandler<onPasteImageEventData>;
|
|
56
|
+
|
|
57
|
+
// Style related props - used for generating proper setters in component's manager
|
|
58
|
+
// These should not be passed as regular props
|
|
59
|
+
color?: ColorValue;
|
|
60
|
+
fontSize?: Float;
|
|
61
|
+
fontFamily?: string;
|
|
62
|
+
fontWeight?: string;
|
|
63
|
+
fontStyle?: string;
|
|
64
|
+
|
|
65
|
+
// other
|
|
66
|
+
androidExperimentalSynchronousEvents?: boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type ComponentType = HostComponent<TypeRichTextInputNativeProps>;
|
|
70
|
+
|
|
71
|
+
interface NativeCommands {
|
|
72
|
+
// General commands
|
|
73
|
+
focus: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
74
|
+
blur: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
75
|
+
setValue: (viewRef: React.ElementRef<ComponentType>, text: string) => void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
79
|
+
supportedCommands: [
|
|
80
|
+
// General commands
|
|
81
|
+
'focus',
|
|
82
|
+
'blur',
|
|
83
|
+
'setValue',
|
|
84
|
+
],
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export default codegenNativeComponent<TypeRichTextInputNativeProps>(
|
|
88
|
+
'TypeRichTextInputView',
|
|
89
|
+
{
|
|
90
|
+
interfaceOnly: true,
|
|
91
|
+
}
|
|
92
|
+
) as HostComponent<TypeRichTextInputNativeProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default","TypeRichTextInput"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,iBAAiB,QAAQ,wBAAqB;AAClE,cAAc,wBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/react-native-codegen.d.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ColorValue, ViewProps } from 'react-native';
|
|
2
|
+
import { type onPasteImageEventData } from './TypeRichTextInputNativeComponent';
|
|
3
|
+
export interface TypeRichTextInputProps extends ViewProps {
|
|
4
|
+
autoFocus?: boolean;
|
|
5
|
+
editable?: boolean;
|
|
6
|
+
defaultValue?: string;
|
|
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;
|
|
16
|
+
onFocus?: () => void;
|
|
17
|
+
onBlur?: () => void;
|
|
18
|
+
onChangeText?: (value: string) => void;
|
|
19
|
+
onChangeSelection?: (start: number, end: number, text: string) => void;
|
|
20
|
+
onPasteImageData?: (data: onPasteImageEventData) => void;
|
|
21
|
+
color?: ColorValue;
|
|
22
|
+
fontSize?: number;
|
|
23
|
+
fontFamily?: string;
|
|
24
|
+
fontWeight?: string;
|
|
25
|
+
fontStyle?: string;
|
|
26
|
+
androidExperimentalSynchronousEvents?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface TypeRichTextInputRef {
|
|
29
|
+
focus: () => void;
|
|
30
|
+
blur: () => void;
|
|
31
|
+
setValue: (text: string) => void;
|
|
32
|
+
}
|
|
33
|
+
declare const TypeRichTextInput: import("react").ForwardRefExoticComponent<TypeRichTextInputProps & import("react").RefAttributes<TypeRichTextInputRef>>;
|
|
34
|
+
export default TypeRichTextInput;
|
|
35
|
+
//# sourceMappingURL=TypeRichTextInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeRichTextInput.d.ts","sourceRoot":"","sources":["../../../src/TypeRichTextInput.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAwB,MAAM,cAAc,CAAC;AAEhF,OAAgC,EAE9B,KAAK,qBAAqB,EAC3B,MAAM,oCAAoC,CAAC;AAG5C,MAAM,WAAW,sBAAuB,SAAQ,SAAS;IACvD,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,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAG1B,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,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvE,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAGzD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,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,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,QAAA,MAAM,iBAAiB,yHAgEtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ColorValue } from 'react-native';
|
|
2
|
+
import { type ViewProps } from 'react-native';
|
|
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';
|
|
6
|
+
export interface OnChangeTextEvent {
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
export interface OnChangeSelectionEvent {
|
|
10
|
+
start: Int32;
|
|
11
|
+
end: Int32;
|
|
12
|
+
text: string;
|
|
13
|
+
}
|
|
14
|
+
export interface onPasteImageEventData {
|
|
15
|
+
uri: string;
|
|
16
|
+
type: string;
|
|
17
|
+
fileName: string;
|
|
18
|
+
fileSize: Double;
|
|
19
|
+
error?: {
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface TypeRichTextInputNativeProps extends ViewProps {
|
|
24
|
+
autoFocus?: boolean;
|
|
25
|
+
editable?: boolean;
|
|
26
|
+
defaultValue?: string;
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
placeholderTextColor?: ColorValue;
|
|
29
|
+
cursorColor?: ColorValue;
|
|
30
|
+
selectionColor?: ColorValue;
|
|
31
|
+
autoCapitalize?: string;
|
|
32
|
+
scrollEnabled?: boolean;
|
|
33
|
+
multiline?: boolean;
|
|
34
|
+
numberOfLines?: Int32;
|
|
35
|
+
secureTextEntry?: boolean;
|
|
36
|
+
onInputFocus?: DirectEventHandler<null>;
|
|
37
|
+
onInputBlur?: DirectEventHandler<null>;
|
|
38
|
+
onChangeText?: DirectEventHandler<OnChangeTextEvent>;
|
|
39
|
+
onChangeSelection?: DirectEventHandler<OnChangeSelectionEvent>;
|
|
40
|
+
onPasteImage?: BubblingEventHandler<onPasteImageEventData>;
|
|
41
|
+
color?: ColorValue;
|
|
42
|
+
fontSize?: Float;
|
|
43
|
+
fontFamily?: string;
|
|
44
|
+
fontWeight?: string;
|
|
45
|
+
fontStyle?: string;
|
|
46
|
+
androidExperimentalSynchronousEvents?: boolean;
|
|
47
|
+
}
|
|
48
|
+
type ComponentType = HostComponent<TypeRichTextInputNativeProps>;
|
|
49
|
+
interface NativeCommands {
|
|
50
|
+
focus: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
51
|
+
blur: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
52
|
+
setValue: (viewRef: React.ElementRef<ComponentType>, text: string) => void;
|
|
53
|
+
}
|
|
54
|
+
export declare const Commands: NativeCommands;
|
|
55
|
+
declare const _default: HostComponent<TypeRichTextInputNativeProps>;
|
|
56
|
+
export default _default;
|
|
57
|
+
//# sourceMappingURL=TypeRichTextInputNativeComponent.d.ts.map
|
|
@@ -0,0 +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,EACP,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACL,KAAK,EACN,MAAM,oDAAoD,CAAC;AAE5D,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,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;IAG1B,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"}
|
|
@@ -0,0 +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,GACvB,MAAM,oCAAoC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-typerich",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Textinput replacement",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"source": "./src/index.tsx",
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"android",
|
|
19
|
+
"ios",
|
|
20
|
+
"cpp",
|
|
21
|
+
"*.podspec",
|
|
22
|
+
"react-native.config.js",
|
|
23
|
+
"!ios/build",
|
|
24
|
+
"!android/build",
|
|
25
|
+
"!android/gradle",
|
|
26
|
+
"!android/gradlew",
|
|
27
|
+
"!android/gradlew.bat",
|
|
28
|
+
"!android/local.properties",
|
|
29
|
+
"!**/__tests__",
|
|
30
|
+
"!**/__fixtures__",
|
|
31
|
+
"!**/__mocks__",
|
|
32
|
+
"!**/.*"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"example": "yarn workspace react-native-typerich-example",
|
|
36
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
37
|
+
"prepare": "bob build",
|
|
38
|
+
"typecheck": "tsc",
|
|
39
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
40
|
+
"release": "release-it --only-version",
|
|
41
|
+
"test": "jest"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"react-native",
|
|
45
|
+
"ios",
|
|
46
|
+
"android"
|
|
47
|
+
],
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/divyanshu-patil/react-native-typerich.git"
|
|
51
|
+
},
|
|
52
|
+
"author": "Divyanshu Patil <work.divyanshupatil@gmail.com> (https://github.com/divyanshu-patil)",
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/divyanshu-patil/react-native-typerich/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/divyanshu-patil/react-native-typerich#readme",
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"registry": "https://registry.npmjs.org/"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
63
|
+
"@eslint/compat": "^1.3.2",
|
|
64
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
65
|
+
"@eslint/js": "^9.35.0",
|
|
66
|
+
"@react-native-community/cli": "20.0.1",
|
|
67
|
+
"@react-native/babel-preset": "0.81.1",
|
|
68
|
+
"@react-native/eslint-config": "^0.81.1",
|
|
69
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
70
|
+
"@types/jest": "^29.5.14",
|
|
71
|
+
"@types/react": "^19.1.0",
|
|
72
|
+
"commitlint": "^19.8.1",
|
|
73
|
+
"del-cli": "^6.0.0",
|
|
74
|
+
"eslint": "^9.35.0",
|
|
75
|
+
"eslint-config-prettier": "^10.1.8",
|
|
76
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
77
|
+
"jest": "^29.7.0",
|
|
78
|
+
"lefthook": "^2.0.3",
|
|
79
|
+
"prettier": "^2.8.8",
|
|
80
|
+
"react": "19.1.0",
|
|
81
|
+
"react-native": "0.81.1",
|
|
82
|
+
"react-native-builder-bob": "^0.40.16",
|
|
83
|
+
"release-it": "^19.0.4",
|
|
84
|
+
"turbo": "^2.5.6",
|
|
85
|
+
"typescript": "^5.9.2"
|
|
86
|
+
},
|
|
87
|
+
"peerDependencies": {
|
|
88
|
+
"react": "*",
|
|
89
|
+
"react-native": "*"
|
|
90
|
+
},
|
|
91
|
+
"workspaces": [
|
|
92
|
+
"example"
|
|
93
|
+
],
|
|
94
|
+
"packageManager": "yarn@4.12.0",
|
|
95
|
+
"react-native-builder-bob": {
|
|
96
|
+
"source": "src",
|
|
97
|
+
"output": "lib",
|
|
98
|
+
"targets": [
|
|
99
|
+
"codegen",
|
|
100
|
+
[
|
|
101
|
+
"module",
|
|
102
|
+
{
|
|
103
|
+
"esm": true
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
"typescript",
|
|
108
|
+
{
|
|
109
|
+
"project": "tsconfig.build.json"
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"prettier": {
|
|
115
|
+
"quoteProps": "consistent",
|
|
116
|
+
"singleQuote": true,
|
|
117
|
+
"tabWidth": 2,
|
|
118
|
+
"trailingComma": "es5",
|
|
119
|
+
"useTabs": false
|
|
120
|
+
},
|
|
121
|
+
"commitlint": {
|
|
122
|
+
"extends": [
|
|
123
|
+
"@commitlint/config-conventional"
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"release-it": {
|
|
127
|
+
"git": {
|
|
128
|
+
"commitMessage": "chore: release ${version}",
|
|
129
|
+
"tagName": "v${version}"
|
|
130
|
+
},
|
|
131
|
+
"npm": {
|
|
132
|
+
"publish": true
|
|
133
|
+
},
|
|
134
|
+
"github": {
|
|
135
|
+
"release": true
|
|
136
|
+
},
|
|
137
|
+
"plugins": {
|
|
138
|
+
"@release-it/conventional-changelog": {
|
|
139
|
+
"preset": {
|
|
140
|
+
"name": "angular"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"jest": {
|
|
146
|
+
"preset": "react-native",
|
|
147
|
+
"modulePathIgnorePatterns": [
|
|
148
|
+
"<rootDir>/example/node_modules",
|
|
149
|
+
"<rootDir>/lib/"
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
"codegenConfig": {
|
|
153
|
+
"name": "TypeRichTextInputViewSpec",
|
|
154
|
+
"type": "components",
|
|
155
|
+
"jsSrcsDir": "src",
|
|
156
|
+
"outputDir": {
|
|
157
|
+
"ios": "ios/generated",
|
|
158
|
+
"android": "android/generated"
|
|
159
|
+
},
|
|
160
|
+
"android": {
|
|
161
|
+
"javaPackageName": "com.typerich"
|
|
162
|
+
},
|
|
163
|
+
"ios": {
|
|
164
|
+
"componentProvider": {
|
|
165
|
+
"TypeRichTextInputView": "TypeRichTextInputView"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"create-react-native-library": {
|
|
170
|
+
"languages": "kotlin-objc",
|
|
171
|
+
"type": "fabric-view",
|
|
172
|
+
"tools": [
|
|
173
|
+
"eslint",
|
|
174
|
+
"lefthook",
|
|
175
|
+
"release-it",
|
|
176
|
+
"jest"
|
|
177
|
+
],
|
|
178
|
+
"version": "0.55.1"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @type {import('@react-native-community/cli-types').UserDependencyConfig}
|
|
3
|
+
*/
|
|
4
|
+
module.exports = {
|
|
5
|
+
dependency: {
|
|
6
|
+
platforms: {
|
|
7
|
+
android: {
|
|
8
|
+
cmakeListsPath: '../android/src/main/new_arch/CMakeLists.txt',
|
|
9
|
+
componentDescriptors: ['TypeRichTextInputViewComponentDescriptor'],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { forwardRef, useImperativeHandle, useRef, type Ref } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { ColorValue, ViewProps, NativeSyntheticEvent } from 'react-native';
|
|
4
|
+
|
|
5
|
+
import NativeTypeRichTextInput, {
|
|
6
|
+
Commands,
|
|
7
|
+
type onPasteImageEventData,
|
|
8
|
+
} from './TypeRichTextInputNativeComponent';
|
|
9
|
+
|
|
10
|
+
// Public facing props (same as NativeProps but events normalized)
|
|
11
|
+
export interface TypeRichTextInputProps extends ViewProps {
|
|
12
|
+
autoFocus?: boolean;
|
|
13
|
+
editable?: boolean;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
placeholderTextColor?: ColorValue;
|
|
17
|
+
cursorColor?: ColorValue;
|
|
18
|
+
selectionColor?: ColorValue;
|
|
19
|
+
autoCapitalize?: string;
|
|
20
|
+
scrollEnabled?: boolean;
|
|
21
|
+
multiline?: boolean;
|
|
22
|
+
numberOfLines?: number;
|
|
23
|
+
secureTextEntry?: boolean;
|
|
24
|
+
|
|
25
|
+
// JS friendly event callbacks
|
|
26
|
+
onFocus?: () => void;
|
|
27
|
+
onBlur?: () => void;
|
|
28
|
+
onChangeText?: (value: string) => void;
|
|
29
|
+
onChangeSelection?: (start: number, end: number, text: string) => void;
|
|
30
|
+
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
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface TypeRichTextInputRef {
|
|
44
|
+
focus: () => void;
|
|
45
|
+
blur: () => void;
|
|
46
|
+
setValue: (text: string) => void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const TypeRichTextInput = forwardRef(
|
|
50
|
+
(props: TypeRichTextInputProps, ref: Ref<TypeRichTextInputRef>) => {
|
|
51
|
+
const nativeRef = useRef(null);
|
|
52
|
+
|
|
53
|
+
useImperativeHandle(ref, () => ({
|
|
54
|
+
focus: () => {
|
|
55
|
+
if (nativeRef.current) {
|
|
56
|
+
Commands.focus(nativeRef.current);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
blur: () => {
|
|
60
|
+
if (nativeRef.current) {
|
|
61
|
+
Commands.blur(nativeRef.current);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
setValue: (text: string) => {
|
|
65
|
+
if (nativeRef.current) {
|
|
66
|
+
Commands.setValue(nativeRef.current, text);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
todo: make this only for NativeSyntheticEvent
|
|
73
|
+
*/
|
|
74
|
+
function handlePasteImage(
|
|
75
|
+
event:
|
|
76
|
+
| onPasteImageEventData
|
|
77
|
+
| { nativeEvent: onPasteImageEventData }
|
|
78
|
+
| NativeSyntheticEvent<onPasteImageEventData>
|
|
79
|
+
| any
|
|
80
|
+
): void {
|
|
81
|
+
// always getting nativeevent but will refactor later
|
|
82
|
+
const data: onPasteImageEventData | undefined =
|
|
83
|
+
event && typeof event === 'object'
|
|
84
|
+
? event.nativeEvent ?? event
|
|
85
|
+
: undefined;
|
|
86
|
+
|
|
87
|
+
if (data) {
|
|
88
|
+
props.onPasteImageData?.(data as onPasteImageEventData);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<NativeTypeRichTextInput
|
|
94
|
+
androidExperimentalSynchronousEvents={
|
|
95
|
+
props.androidExperimentalSynchronousEvents
|
|
96
|
+
}
|
|
97
|
+
ref={nativeRef}
|
|
98
|
+
{...props}
|
|
99
|
+
onInputFocus={() => props.onFocus?.()}
|
|
100
|
+
onInputBlur={() => props.onBlur?.()}
|
|
101
|
+
onChangeText={(event) => props.onChangeText?.(event.nativeEvent.value)}
|
|
102
|
+
onChangeSelection={(event) =>
|
|
103
|
+
props.onChangeSelection?.(
|
|
104
|
+
event.nativeEvent.start,
|
|
105
|
+
event.nativeEvent.end,
|
|
106
|
+
event.nativeEvent.text
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
onPasteImage={handlePasteImage}
|
|
110
|
+
/>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
export default TypeRichTextInput;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { ColorValue } from 'react-native';
|
|
2
|
+
import {
|
|
3
|
+
codegenNativeComponent,
|
|
4
|
+
codegenNativeCommands,
|
|
5
|
+
type ViewProps,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
import type { HostComponent } from 'react-native';
|
|
8
|
+
import type {
|
|
9
|
+
BubblingEventHandler,
|
|
10
|
+
Double,
|
|
11
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
12
|
+
import type {
|
|
13
|
+
DirectEventHandler,
|
|
14
|
+
Float,
|
|
15
|
+
Int32,
|
|
16
|
+
} from 'react-native/Libraries/Types/CodegenTypesNamespace';
|
|
17
|
+
|
|
18
|
+
export interface OnChangeTextEvent {
|
|
19
|
+
value: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface OnChangeSelectionEvent {
|
|
23
|
+
start: Int32;
|
|
24
|
+
end: Int32;
|
|
25
|
+
text: string;
|
|
26
|
+
}
|
|
27
|
+
export interface onPasteImageEventData {
|
|
28
|
+
uri: string;
|
|
29
|
+
type: string;
|
|
30
|
+
fileName: string;
|
|
31
|
+
fileSize: Double;
|
|
32
|
+
error?: { message: string };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface TypeRichTextInputNativeProps extends ViewProps {
|
|
36
|
+
// base props
|
|
37
|
+
autoFocus?: boolean;
|
|
38
|
+
editable?: boolean;
|
|
39
|
+
defaultValue?: string;
|
|
40
|
+
placeholder?: string;
|
|
41
|
+
placeholderTextColor?: ColorValue;
|
|
42
|
+
cursorColor?: ColorValue;
|
|
43
|
+
selectionColor?: ColorValue;
|
|
44
|
+
autoCapitalize?: string;
|
|
45
|
+
scrollEnabled?: boolean;
|
|
46
|
+
multiline?: boolean;
|
|
47
|
+
numberOfLines?: Int32;
|
|
48
|
+
secureTextEntry?: boolean;
|
|
49
|
+
|
|
50
|
+
// event callbacks
|
|
51
|
+
onInputFocus?: DirectEventHandler<null>;
|
|
52
|
+
onInputBlur?: DirectEventHandler<null>;
|
|
53
|
+
onChangeText?: DirectEventHandler<OnChangeTextEvent>;
|
|
54
|
+
onChangeSelection?: DirectEventHandler<OnChangeSelectionEvent>;
|
|
55
|
+
onPasteImage?: BubblingEventHandler<onPasteImageEventData>;
|
|
56
|
+
|
|
57
|
+
// Style related props - used for generating proper setters in component's manager
|
|
58
|
+
// These should not be passed as regular props
|
|
59
|
+
color?: ColorValue;
|
|
60
|
+
fontSize?: Float;
|
|
61
|
+
fontFamily?: string;
|
|
62
|
+
fontWeight?: string;
|
|
63
|
+
fontStyle?: string;
|
|
64
|
+
|
|
65
|
+
// other
|
|
66
|
+
androidExperimentalSynchronousEvents?: boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type ComponentType = HostComponent<TypeRichTextInputNativeProps>;
|
|
70
|
+
|
|
71
|
+
interface NativeCommands {
|
|
72
|
+
// General commands
|
|
73
|
+
focus: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
74
|
+
blur: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
75
|
+
setValue: (viewRef: React.ElementRef<ComponentType>, text: string) => void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
79
|
+
supportedCommands: [
|
|
80
|
+
// General commands
|
|
81
|
+
'focus',
|
|
82
|
+
'blur',
|
|
83
|
+
'setValue',
|
|
84
|
+
],
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export default codegenNativeComponent<TypeRichTextInputNativeProps>(
|
|
88
|
+
'TypeRichTextInputView',
|
|
89
|
+
{
|
|
90
|
+
interfaceOnly: true,
|
|
91
|
+
}
|
|
92
|
+
) as HostComponent<TypeRichTextInputNativeProps>;
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare module 'react-native/Libraries/Types/CodegenTypes' {
|
|
2
|
+
export type Int32 = number;
|
|
3
|
+
export type Float = number;
|
|
4
|
+
export type Double = number;
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
7
|
+
export type WithDefault<T, DefaultT> = T;
|
|
8
|
+
|
|
9
|
+
export type BubblingEventHandler<T> = (event: T) => void;
|
|
10
|
+
export type DirectEventHandler<T> = (event: T) => void;
|
|
11
|
+
}
|