@azsxdc12356/react-native-sync-format-edittext 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +130 -0
  3. package/SyncFormatEdittext.podspec +20 -0
  4. package/android/build.gradle +105 -0
  5. package/android/src/main/AndroidManifest.xml +2 -0
  6. package/android/src/main/cpp/CMakeLists.txt +28 -0
  7. package/android/src/main/cpp/FormatHostObject.cpp +117 -0
  8. package/android/src/main/cpp/FormatHostObject.h +38 -0
  9. package/android/src/main/cpp/FormatModuleJNI.cpp +80 -0
  10. package/android/src/main/java/com/syncformatedittext/FormatModuleImpl.kt +77 -0
  11. package/android/src/main/java/com/syncformatedittext/SyncFormatEdittextView.kt +70 -0
  12. package/android/src/newarch/java/com/syncformatedittext/FormatModule.kt +19 -0
  13. package/android/src/newarch/java/com/syncformatedittext/SyncFormatEditTextChangeEvent.kt +22 -0
  14. package/android/src/newarch/java/com/syncformatedittext/SyncFormatEdittextPackage.kt +37 -0
  15. package/android/src/newarch/java/com/syncformatedittext/SyncFormatEdittextViewManager.kt +61 -0
  16. package/android/src/oldarch/java/com/syncformatedittext/FormatModule.kt +23 -0
  17. package/android/src/oldarch/java/com/syncformatedittext/SyncFormatEditTextChangeEvent.kt +21 -0
  18. package/android/src/oldarch/java/com/syncformatedittext/SyncFormatEdittextPackage.kt +18 -0
  19. package/android/src/oldarch/java/com/syncformatedittext/SyncFormatEdittextViewManager.kt +60 -0
  20. package/ios/SyncFormatEdittextView.h +14 -0
  21. package/ios/SyncFormatEdittextView.mm +48 -0
  22. package/lib/module/NativeFormatModule.js +5 -0
  23. package/lib/module/NativeFormatModule.js.map +1 -0
  24. package/lib/module/SyncFormatEdittextView.js +14 -0
  25. package/lib/module/SyncFormatEdittextView.js.map +1 -0
  26. package/lib/module/SyncFormatEdittextView.native.js +49 -0
  27. package/lib/module/SyncFormatEdittextView.native.js.map +1 -0
  28. package/lib/module/SyncFormatEdittextViewNativeComponent.ts +198 -0
  29. package/lib/module/index.js +4 -0
  30. package/lib/module/index.js.map +1 -0
  31. package/lib/module/package.json +1 -0
  32. package/lib/typescript/package.json +1 -0
  33. package/lib/typescript/src/NativeFormatModule.d.ts +7 -0
  34. package/lib/typescript/src/NativeFormatModule.d.ts.map +1 -0
  35. package/lib/typescript/src/SyncFormatEdittextView.d.ts +3 -0
  36. package/lib/typescript/src/SyncFormatEdittextView.d.ts.map +1 -0
  37. package/lib/typescript/src/SyncFormatEdittextView.native.d.ts +12 -0
  38. package/lib/typescript/src/SyncFormatEdittextView.native.d.ts.map +1 -0
  39. package/lib/typescript/src/SyncFormatEdittextViewNativeComponent.d.ts +139 -0
  40. package/lib/typescript/src/SyncFormatEdittextViewNativeComponent.d.ts.map +1 -0
  41. package/lib/typescript/src/index.d.ts +3 -0
  42. package/lib/typescript/src/index.d.ts.map +1 -0
  43. package/package.json +181 -0
  44. package/src/NativeFormatModule.ts +8 -0
  45. package/src/SyncFormatEdittextView.native.tsx +81 -0
  46. package/src/SyncFormatEdittextView.tsx +6 -0
  47. package/src/SyncFormatEdittextViewNativeComponent.ts +198 -0
  48. package/src/index.tsx +2 -0
@@ -0,0 +1,139 @@
1
+ import type { CodegenTypes } from 'react-native';
2
+ import { type ViewProps } from 'react-native';
3
+ type KeyboardType = 'default' | 'email-address' | 'numeric' | 'phone-pad' | 'number-pad' | 'decimal-pad' | 'url' | 'ascii-capable' | 'numbers-and-punctuation' | 'name-phone-pad' | 'twitter' | 'web-search' | 'visible-password';
4
+ type ReturnKeyType = 'done' | 'go' | 'next' | 'search' | 'send' | 'none' | 'previous' | 'default' | 'emergency-call' | 'google' | 'join' | 'route' | 'yahoo';
5
+ type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline';
6
+ interface NativeProps extends ViewProps {
7
+ autoComplete?: CodegenTypes.WithDefault<'birthdate-day' | 'birthdate-full' | 'birthdate-month' | 'birthdate-year' | 'cc-csc' | 'cc-exp' | 'cc-exp-day' | 'cc-exp-month' | 'cc-exp-year' | 'cc-number' | 'email' | 'gender' | 'name' | 'name-family' | 'name-given' | 'name-middle' | 'name-middle-initial' | 'name-prefix' | 'name-suffix' | 'password' | 'password-new' | 'postal-address' | 'postal-address-country' | 'postal-address-extended' | 'postal-address-extended-postal-code' | 'postal-address-locality' | 'postal-address-region' | 'postal-code' | 'street-address' | 'sms-otp' | 'tel' | 'tel-country-code' | 'tel-national' | 'tel-device' | 'username' | 'username-new' | 'off', 'off'>;
8
+ returnKeyLabel?: string;
9
+ numberOfLines?: CodegenTypes.Int32;
10
+ disableFullscreenUI?: boolean;
11
+ textBreakStrategy?: CodegenTypes.WithDefault<'simple' | 'highQuality' | 'balanced', 'simple'>;
12
+ underlineColorAndroid?: CodegenTypes.Int32;
13
+ inlineImageLeft?: string;
14
+ inlineImagePadding?: CodegenTypes.Int32;
15
+ importantForAutofill?: string;
16
+ showSoftInputOnFocus?: boolean;
17
+ autoCapitalize?: CodegenTypes.WithDefault<'none' | 'sentences' | 'words' | 'characters', 'none'>;
18
+ autoCorrect?: boolean;
19
+ autoFocus?: boolean;
20
+ allowFontScaling?: boolean;
21
+ maxFontSizeMultiplier?: CodegenTypes.Float;
22
+ editable?: boolean;
23
+ keyboardType?: CodegenTypes.WithDefault<KeyboardType, 'default'>;
24
+ returnKeyType?: CodegenTypes.WithDefault<ReturnKeyType, 'done'>;
25
+ maxLength?: CodegenTypes.Int32;
26
+ multiline?: boolean;
27
+ onBlur?: CodegenTypes.BubblingEventHandler<{
28
+ target: CodegenTypes.Int32;
29
+ }>;
30
+ onFocus?: CodegenTypes.BubblingEventHandler<{
31
+ target: CodegenTypes.Int32;
32
+ }>;
33
+ onChange?: CodegenTypes.BubblingEventHandler<{
34
+ target: CodegenTypes.Int32;
35
+ eventCount: CodegenTypes.Int32;
36
+ text: string;
37
+ }>;
38
+ onChangeText?: CodegenTypes.BubblingEventHandler<{
39
+ target: CodegenTypes.Int32;
40
+ eventCount: CodegenTypes.Int32;
41
+ text: string;
42
+ }>;
43
+ onContentSizeChange?: CodegenTypes.DirectEventHandler<{
44
+ target: CodegenTypes.Int32;
45
+ contentSize: {
46
+ width: CodegenTypes.Double;
47
+ height: CodegenTypes.Double;
48
+ };
49
+ }>;
50
+ onEndEditing?: CodegenTypes.BubblingEventHandler<{
51
+ target: CodegenTypes.Int32;
52
+ text: string;
53
+ }>;
54
+ onSelectionChange?: CodegenTypes.DirectEventHandler<{
55
+ target: CodegenTypes.Int32;
56
+ selection: {
57
+ start: CodegenTypes.Double;
58
+ end: CodegenTypes.Double;
59
+ };
60
+ }>;
61
+ onSubmitEditing?: CodegenTypes.BubblingEventHandler<{
62
+ target: CodegenTypes.Int32;
63
+ text: string;
64
+ }>;
65
+ onKeyPress?: CodegenTypes.BubblingEventHandler<{
66
+ target: CodegenTypes.Int32;
67
+ key: string;
68
+ }>;
69
+ onScroll?: CodegenTypes.DirectEventHandler<{
70
+ target: CodegenTypes.Int32;
71
+ responderIgnoreScroll: boolean;
72
+ contentInset: {
73
+ top: CodegenTypes.Double;
74
+ bottom: CodegenTypes.Double;
75
+ left: CodegenTypes.Double;
76
+ right: CodegenTypes.Double;
77
+ };
78
+ contentOffset: {
79
+ x: CodegenTypes.Double;
80
+ y: CodegenTypes.Double;
81
+ };
82
+ contentSize: {
83
+ width: CodegenTypes.Double;
84
+ height: CodegenTypes.Double;
85
+ };
86
+ layoutMeasurement: {
87
+ width: CodegenTypes.Double;
88
+ height: CodegenTypes.Double;
89
+ };
90
+ velocity: {
91
+ x: CodegenTypes.Double;
92
+ y: CodegenTypes.Double;
93
+ };
94
+ }>;
95
+ placeholder?: string;
96
+ placeholderTextColor?: CodegenTypes.Int32;
97
+ secureTextEntry?: boolean;
98
+ selectionColor?: CodegenTypes.Int32;
99
+ selectionHandleColor?: CodegenTypes.Int32;
100
+ selection?: {
101
+ start: CodegenTypes.Int32;
102
+ end?: CodegenTypes.Int32;
103
+ };
104
+ value?: string;
105
+ defaultValue?: string;
106
+ selectTextOnFocus?: boolean;
107
+ blurOnSubmit?: boolean;
108
+ submitBehavior?: CodegenTypes.WithDefault<SubmitBehavior, 'blurAndSubmit'>;
109
+ caretHidden?: boolean;
110
+ contextMenuHidden?: boolean;
111
+ textShadowColor?: CodegenTypes.Int32;
112
+ textShadowRadius?: CodegenTypes.Float;
113
+ textDecorationLine?: string;
114
+ fontStyle?: string;
115
+ textShadowOffset?: {
116
+ width?: CodegenTypes.Double;
117
+ height?: CodegenTypes.Double;
118
+ };
119
+ lineHeight?: CodegenTypes.Float;
120
+ textTransform?: string;
121
+ color?: CodegenTypes.Int32;
122
+ letterSpacing?: CodegenTypes.Float;
123
+ fontSize?: CodegenTypes.Float;
124
+ textAlign?: string;
125
+ includeFontPadding?: boolean;
126
+ fontWeight?: string;
127
+ fontFamily?: string;
128
+ textAlignVertical?: string;
129
+ cursorColor?: CodegenTypes.Int32;
130
+ mostRecentEventCount?: CodegenTypes.Int32;
131
+ text?: string;
132
+ onSyncFormatChange?: CodegenTypes.DirectEventHandler<{
133
+ text: string;
134
+ cursorPos: CodegenTypes.Double;
135
+ }>;
136
+ }
137
+ declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
138
+ export default _default;
139
+ //# sourceMappingURL=SyncFormatEdittextViewNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyncFormatEdittextViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/SyncFormatEdittextViewNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,KAAK,YAAY,GACb,SAAS,GACT,eAAe,GACf,SAAS,GACT,WAAW,GACX,YAAY,GACZ,aAAa,GACb,KAAK,GACL,eAAe,GACf,yBAAyB,GACzB,gBAAgB,GAChB,SAAS,GACT,YAAY,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gB,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,YAAY,CAAC,MAAM,CAAA;KAAE,CAAC;IACjF,UAAU,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;IAC3B,aAAa,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;IACnC,QAAQ,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;IAGjC,oBAAoB,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,kBAAkB,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC;QACnD,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,YAAY,CAAC,MAAM,CAAC;KAChC,CAAC,CAAC;CACJ;;AAED,wBAA6E"}
@@ -0,0 +1,3 @@
1
+ export { SyncFormatEdittextView } from './SyncFormatEdittextView';
2
+ export type { SyncFormatEditTextProps } from './SyncFormatEdittextView.native';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,181 @@
1
+ {
2
+ "name": "@azsxdc12356/react-native-sync-format-edittext",
3
+ "version": "1.0.0",
4
+ "description": "React Native sync format input — flicker-free real-time text formatting via JSI synchronous calls",
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-sync-format-edittext-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
+ "test": "jest",
41
+ "release": "release-it --only-version",
42
+ "web": "vite",
43
+ "build:web": "vite build"
44
+ },
45
+ "keywords": [
46
+ "react-native",
47
+ "ios",
48
+ "android"
49
+ ],
50
+ "repository": {
51
+ "type": "git",
52
+ "url": "git+https://github.com/junjie-z666/react-native-sync-format-edittext.git"
53
+ },
54
+ "author": "junjie-z666",
55
+ "license": "MIT",
56
+ "bugs": {
57
+ "url": "https://github.com/junjie-z666/react-native-sync-format-edittext/issues"
58
+ },
59
+ "homepage": "https://github.com/junjie-z666/react-native-sync-format-edittext#readme",
60
+ "publishConfig": {
61
+ "registry": "https://registry.npmjs.org/"
62
+ },
63
+ "devDependencies": {
64
+ "@commitlint/config-conventional": "^20.5.0",
65
+ "@eslint/compat": "^2.0.3",
66
+ "@eslint/eslintrc": "^3.3.5",
67
+ "@eslint/js": "^10.0.1",
68
+ "@jest/globals": "^30.0.0",
69
+ "@react-native/babel-preset": "0.81.6",
70
+ "@react-native/eslint-config": "0.81.6",
71
+ "@release-it/conventional-changelog": "^10.0.6",
72
+ "@types/react": "^19.2.0",
73
+ "commitlint": "^20.5.0",
74
+ "del-cli": "^7.0.0",
75
+ "eslint": "^9.39.4",
76
+ "eslint-config-prettier": "^10.1.8",
77
+ "eslint-plugin-ft-flow": "^3.0.11",
78
+ "eslint-plugin-prettier": "^5.5.5",
79
+ "jest": "^30.3.0",
80
+ "lefthook": "^2.1.4",
81
+ "prettier": "^3.8.1",
82
+ "react": "19.1.4",
83
+ "react-native": "0.81.6",
84
+ "react-native-builder-bob": "^0.41.0",
85
+ "react-native-web": "~0.21.1",
86
+ "release-it": "^19.2.4",
87
+ "turbo": "^2.8.21",
88
+ "typescript": "^6.0.2"
89
+ },
90
+ "peerDependencies": {
91
+ "react": "*",
92
+ "react-native": "*"
93
+ },
94
+ "workspaces": [
95
+ "example"
96
+ ],
97
+ "packageManager": "yarn@4.11.0",
98
+ "react-native-builder-bob": {
99
+ "source": "src",
100
+ "output": "lib",
101
+ "targets": [
102
+ [
103
+ "module",
104
+ {
105
+ "esm": true
106
+ }
107
+ ],
108
+ [
109
+ "typescript",
110
+ {
111
+ "project": "tsconfig.build.json"
112
+ }
113
+ ]
114
+ ]
115
+ },
116
+ "codegenConfig": {
117
+ "name": "SyncFormatEdittextViewSpec",
118
+ "type": "all",
119
+ "jsSrcsDir": "src",
120
+ "android": {
121
+ "javaPackageName": "com.syncformatedittext"
122
+ },
123
+ "ios": {
124
+ "components": {
125
+ "SyncFormatEdittextView": {
126
+ "className": "SyncFormatEdittextView"
127
+ }
128
+ }
129
+ }
130
+ },
131
+ "prettier": {
132
+ "quoteProps": "consistent",
133
+ "singleQuote": true,
134
+ "tabWidth": 2,
135
+ "trailingComma": "es5",
136
+ "useTabs": false
137
+ },
138
+ "jest": {
139
+ "preset": "react-native",
140
+ "modulePathIgnorePatterns": [
141
+ "<rootDir>/example/node_modules",
142
+ "<rootDir>/lib/"
143
+ ]
144
+ },
145
+ "commitlint": {
146
+ "extends": [
147
+ "@commitlint/config-conventional"
148
+ ]
149
+ },
150
+ "release-it": {
151
+ "git": {
152
+ "commitMessage": "chore: release ${version}",
153
+ "tagName": "v${version}"
154
+ },
155
+ "npm": {
156
+ "publish": true
157
+ },
158
+ "github": {
159
+ "release": true
160
+ },
161
+ "plugins": {
162
+ "@release-it/conventional-changelog": {
163
+ "preset": {
164
+ "name": "angular"
165
+ }
166
+ }
167
+ }
168
+ },
169
+ "create-react-native-library": {
170
+ "type": "fabric-view",
171
+ "languages": "kotlin-objc",
172
+ "tools": [
173
+ "eslint",
174
+ "jest",
175
+ "lefthook",
176
+ "release-it",
177
+ "vite"
178
+ ],
179
+ "version": "0.62.0"
180
+ }
181
+ }
@@ -0,0 +1,8 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ export interface Spec extends TurboModule {
5
+ install(): void;
6
+ }
7
+
8
+ export default TurboModuleRegistry.getEnforcing<Spec>('FormatModule');
@@ -0,0 +1,81 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ import {
3
+ findNodeHandle,
4
+ TurboModuleRegistry,
5
+ type NativeSyntheticEvent,
6
+ type TextInputProps,
7
+ } from 'react-native';
8
+ import SyncFormatEdittextViewNativeComponent from './SyncFormatEdittextViewNativeComponent';
9
+
10
+ type FormatFn = (
11
+ text: string,
12
+ cursorPos: number
13
+ ) => { text: string; cursorPos: number };
14
+
15
+ type SyncFormatChangeEvent = NativeSyntheticEvent<{
16
+ text: string;
17
+ cursorPos: number;
18
+ }>;
19
+
20
+ export type SyncFormatEditTextProps = TextInputProps & {
21
+ format?: FormatFn;
22
+ onSyncFormatChange?: (text: string, cursorPos: number) => void;
23
+ };
24
+
25
+ // Install JSI bindings on first use
26
+ try {
27
+ const fmtModule = TurboModuleRegistry.getEnforcing(
28
+ 'FormatModule'
29
+ ) as unknown as { install(): void };
30
+ fmtModule.install();
31
+ } catch {}
32
+
33
+ export function SyncFormatEdittextView({
34
+ format,
35
+ onSyncFormatChange,
36
+ onChange,
37
+ onChangeText,
38
+ ...rest
39
+ }: SyncFormatEditTextProps) {
40
+ const viewRef = useRef(null);
41
+
42
+ useEffect(() => {
43
+ if (!format || !viewRef.current) return;
44
+
45
+ const formatModule = (globalThis as any).__formatModule as
46
+ | {
47
+ setFormat(viewTag: number, fn: FormatFn): void;
48
+ removeFormat(viewTag: number): void;
49
+ }
50
+ | undefined;
51
+ if (!formatModule) return;
52
+
53
+ const tag = findNodeHandle(viewRef.current);
54
+ if (tag) {
55
+ formatModule.setFormat(tag, format);
56
+ }
57
+ return () => {
58
+ if (tag) {
59
+ formatModule.removeFormat(tag);
60
+ }
61
+ };
62
+ }, [viewRef.current]);
63
+
64
+ const handleSyncFormatChange = useCallback(
65
+ (event: SyncFormatChangeEvent) => {
66
+ const { text, cursorPos } = event.nativeEvent;
67
+ onSyncFormatChange?.(text, cursorPos);
68
+ },
69
+ [onSyncFormatChange]
70
+ );
71
+
72
+ return (
73
+ <SyncFormatEdittextViewNativeComponent
74
+ ref={viewRef}
75
+ {...(rest as any)}
76
+ onChange={onChange as any}
77
+ onChangeText={onChangeText as any}
78
+ onSyncFormatChange={handleSyncFormatChange}
79
+ />
80
+ );
81
+ }
@@ -0,0 +1,6 @@
1
+ import { View } from 'react-native';
2
+ import type { SyncFormatEditTextProps } from './SyncFormatEdittextView.native';
3
+
4
+ export function SyncFormatEdittextView({ format, onSyncFormatChange, ...rest }: SyncFormatEditTextProps) {
5
+ return <View {...(rest as any)} />;
6
+ }
@@ -0,0 +1,198 @@
1
+ import type { CodegenTypes } from 'react-native';
2
+ import { codegenNativeComponent, type ViewProps } from 'react-native';
3
+
4
+ type KeyboardType =
5
+ | 'default'
6
+ | 'email-address'
7
+ | 'numeric'
8
+ | 'phone-pad'
9
+ | 'number-pad'
10
+ | 'decimal-pad'
11
+ | 'url'
12
+ | 'ascii-capable'
13
+ | 'numbers-and-punctuation'
14
+ | 'name-phone-pad'
15
+ | 'twitter'
16
+ | 'web-search'
17
+ | 'visible-password';
18
+
19
+ type ReturnKeyType =
20
+ | 'done'
21
+ | 'go'
22
+ | 'next'
23
+ | 'search'
24
+ | 'send'
25
+ | 'none'
26
+ | 'previous'
27
+ | 'default'
28
+ | 'emergency-call'
29
+ | 'google'
30
+ | 'join'
31
+ | 'route'
32
+ | 'yahoo';
33
+
34
+ type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline';
35
+
36
+ interface NativeProps extends ViewProps {
37
+ // Android-specific props
38
+ autoComplete?: CodegenTypes.WithDefault<
39
+ | 'birthdate-day'
40
+ | 'birthdate-full'
41
+ | 'birthdate-month'
42
+ | 'birthdate-year'
43
+ | 'cc-csc'
44
+ | 'cc-exp'
45
+ | 'cc-exp-day'
46
+ | 'cc-exp-month'
47
+ | 'cc-exp-year'
48
+ | 'cc-number'
49
+ | 'email'
50
+ | 'gender'
51
+ | 'name'
52
+ | 'name-family'
53
+ | 'name-given'
54
+ | 'name-middle'
55
+ | 'name-middle-initial'
56
+ | 'name-prefix'
57
+ | 'name-suffix'
58
+ | 'password'
59
+ | 'password-new'
60
+ | 'postal-address'
61
+ | 'postal-address-country'
62
+ | 'postal-address-extended'
63
+ | 'postal-address-extended-postal-code'
64
+ | 'postal-address-locality'
65
+ | 'postal-address-region'
66
+ | 'postal-code'
67
+ | 'street-address'
68
+ | 'sms-otp'
69
+ | 'tel'
70
+ | 'tel-country-code'
71
+ | 'tel-national'
72
+ | 'tel-device'
73
+ | 'username'
74
+ | 'username-new'
75
+ | 'off',
76
+ 'off'
77
+ >;
78
+ returnKeyLabel?: string;
79
+ numberOfLines?: CodegenTypes.Int32;
80
+ disableFullscreenUI?: boolean;
81
+ textBreakStrategy?: CodegenTypes.WithDefault<
82
+ 'simple' | 'highQuality' | 'balanced',
83
+ 'simple'
84
+ >;
85
+ underlineColorAndroid?: CodegenTypes.Int32;
86
+ inlineImageLeft?: string;
87
+ inlineImagePadding?: CodegenTypes.Int32;
88
+ importantForAutofill?: string;
89
+ showSoftInputOnFocus?: boolean;
90
+
91
+ // TextInput core props
92
+ autoCapitalize?: CodegenTypes.WithDefault<
93
+ 'none' | 'sentences' | 'words' | 'characters',
94
+ 'none'
95
+ >;
96
+ autoCorrect?: boolean;
97
+ autoFocus?: boolean;
98
+ allowFontScaling?: boolean;
99
+ maxFontSizeMultiplier?: CodegenTypes.Float;
100
+ editable?: boolean;
101
+ keyboardType?: CodegenTypes.WithDefault<KeyboardType, 'default'>;
102
+ returnKeyType?: CodegenTypes.WithDefault<ReturnKeyType, 'done'>;
103
+ maxLength?: CodegenTypes.Int32;
104
+ multiline?: boolean;
105
+
106
+ // Events
107
+ onBlur?: CodegenTypes.BubblingEventHandler<{ target: CodegenTypes.Int32 }>;
108
+ onFocus?: CodegenTypes.BubblingEventHandler<{ target: CodegenTypes.Int32 }>;
109
+ onChange?: CodegenTypes.BubblingEventHandler<{
110
+ target: CodegenTypes.Int32;
111
+ eventCount: CodegenTypes.Int32;
112
+ text: string;
113
+ }>;
114
+ onChangeText?: CodegenTypes.BubblingEventHandler<{
115
+ target: CodegenTypes.Int32;
116
+ eventCount: CodegenTypes.Int32;
117
+ text: string;
118
+ }>;
119
+ onContentSizeChange?: CodegenTypes.DirectEventHandler<{
120
+ target: CodegenTypes.Int32;
121
+ contentSize: { width: CodegenTypes.Double; height: CodegenTypes.Double };
122
+ }>;
123
+ onEndEditing?: CodegenTypes.BubblingEventHandler<{
124
+ target: CodegenTypes.Int32;
125
+ text: string;
126
+ }>;
127
+ onSelectionChange?: CodegenTypes.DirectEventHandler<{
128
+ target: CodegenTypes.Int32;
129
+ selection: { start: CodegenTypes.Double; end: CodegenTypes.Double };
130
+ }>;
131
+ onSubmitEditing?: CodegenTypes.BubblingEventHandler<{
132
+ target: CodegenTypes.Int32;
133
+ text: string;
134
+ }>;
135
+ onKeyPress?: CodegenTypes.BubblingEventHandler<{
136
+ target: CodegenTypes.Int32;
137
+ key: string;
138
+ }>;
139
+ onScroll?: CodegenTypes.DirectEventHandler<{
140
+ target: CodegenTypes.Int32;
141
+ responderIgnoreScroll: boolean;
142
+ contentInset: {
143
+ top: CodegenTypes.Double;
144
+ bottom: CodegenTypes.Double;
145
+ left: CodegenTypes.Double;
146
+ right: CodegenTypes.Double;
147
+ };
148
+ contentOffset: { x: CodegenTypes.Double; y: CodegenTypes.Double };
149
+ contentSize: { width: CodegenTypes.Double; height: CodegenTypes.Double };
150
+ layoutMeasurement: { width: CodegenTypes.Double; height: CodegenTypes.Double };
151
+ velocity: { x: CodegenTypes.Double; y: CodegenTypes.Double };
152
+ }>;
153
+
154
+ // Value and display props
155
+ placeholder?: string;
156
+ placeholderTextColor?: CodegenTypes.Int32;
157
+ secureTextEntry?: boolean;
158
+ selectionColor?: CodegenTypes.Int32;
159
+ selectionHandleColor?: CodegenTypes.Int32;
160
+ selection?: { start: CodegenTypes.Int32; end?: CodegenTypes.Int32 };
161
+ value?: string;
162
+ defaultValue?: string;
163
+ selectTextOnFocus?: boolean;
164
+ blurOnSubmit?: boolean;
165
+ submitBehavior?: CodegenTypes.WithDefault<SubmitBehavior, 'blurAndSubmit'>;
166
+ caretHidden?: boolean;
167
+ contextMenuHidden?: boolean;
168
+
169
+ // Text styling props
170
+ textShadowColor?: CodegenTypes.Int32;
171
+ textShadowRadius?: CodegenTypes.Float;
172
+ textDecorationLine?: string;
173
+ fontStyle?: string;
174
+ textShadowOffset?: { width?: CodegenTypes.Double; height?: CodegenTypes.Double };
175
+ lineHeight?: CodegenTypes.Float;
176
+ textTransform?: string;
177
+ color?: CodegenTypes.Int32;
178
+ letterSpacing?: CodegenTypes.Float;
179
+ fontSize?: CodegenTypes.Float;
180
+ textAlign?: string;
181
+ includeFontPadding?: boolean;
182
+ fontWeight?: string;
183
+ fontFamily?: string;
184
+ textAlignVertical?: string;
185
+ cursorColor?: CodegenTypes.Int32;
186
+
187
+ // Internal props (used by TextInput.js)
188
+ mostRecentEventCount?: CodegenTypes.Int32;
189
+ text?: string;
190
+
191
+ // Custom: sync format event
192
+ onSyncFormatChange?: CodegenTypes.DirectEventHandler<{
193
+ text: string;
194
+ cursorPos: CodegenTypes.Double;
195
+ }>;
196
+ }
197
+
198
+ export default codegenNativeComponent<NativeProps>('SyncFormatEdittextView');
package/src/index.tsx ADDED
@@ -0,0 +1,2 @@
1
+ export { SyncFormatEdittextView } from './SyncFormatEdittextView';
2
+ export type { SyncFormatEditTextProps } from './SyncFormatEdittextView.native';