react-native-transformer-text-input 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/jni/CMakeLists.txt +27 -2
- package/lib/module/Transformer.js +10 -3
- package/lib/module/Transformer.js.map +1 -1
- package/lib/module/TransformerTextInput.js.map +1 -1
- package/lib/module/TransformerTextInput.types.js +4 -0
- package/lib/module/TransformerTextInput.types.js.map +1 -0
- package/lib/module/TransformerTextInput.web.js +134 -0
- package/lib/module/TransformerTextInput.web.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/Transformer.d.ts.map +1 -1
- package/lib/typescript/src/TransformerTextInput.d.ts +3 -44
- package/lib/typescript/src/TransformerTextInput.d.ts.map +1 -1
- package/lib/typescript/src/TransformerTextInput.types.d.ts +40 -0
- package/lib/typescript/src/TransformerTextInput.types.d.ts.map +1 -0
- package/lib/typescript/src/TransformerTextInput.web.d.ts +206 -0
- package/lib/typescript/src/TransformerTextInput.web.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/Transformer.ts +13 -5
- package/src/TransformerTextInput.tsx +11 -44
- package/src/TransformerTextInput.types.ts +40 -0
- package/src/TransformerTextInput.web.tsx +161 -0
|
@@ -9,12 +9,12 @@ set(LIB_COMMON_DIR ${LIB_ANDROID_DIR}/../cpp)
|
|
|
9
9
|
set(LIB_ANDROID_GENERATED_JNI_DIR ${LIB_ANDROID_DIR}/build/generated/source/codegen/jni)
|
|
10
10
|
set(LIB_ANDROID_GENERATED_COMPONENTS_DIR ${LIB_ANDROID_GENERATED_JNI_DIR}/react/renderer/components/${LIB_LITERAL})
|
|
11
11
|
|
|
12
|
+
set(NODE_BINARY "node" CACHE STRING "Path to Node.js binary")
|
|
13
|
+
|
|
12
14
|
# Resolve path to react-native-worklets.
|
|
13
15
|
set(REACT_NATIVE_WORKLETS_DIR "" CACHE PATH "Path to react-native-worklets root directory")
|
|
14
16
|
|
|
15
17
|
if(NOT DEFINED REACT_NATIVE_WORKLETS_DIR OR "${REACT_NATIVE_WORKLETS_DIR}" STREQUAL "")
|
|
16
|
-
set(NODE_BINARY "node" CACHE STRING "Path to Node.js binary")
|
|
17
|
-
|
|
18
18
|
execute_process(
|
|
19
19
|
COMMAND "${NODE_BINARY}" -p "require.resolve('react-native-worklets/package.json')"
|
|
20
20
|
WORKING_DIRECTORY "${PROJECT_ROOT_DIR}/.."
|
|
@@ -34,6 +34,25 @@ if(NOT DEFINED REACT_NATIVE_WORKLETS_DIR OR "${REACT_NATIVE_WORKLETS_DIR}" STREQ
|
|
|
34
34
|
get_filename_component(REACT_NATIVE_WORKLETS_DIR "${_worklets_pkg_json}" DIRECTORY)
|
|
35
35
|
endif()
|
|
36
36
|
|
|
37
|
+
# Resolve React Native minor version so worklets headers pick the correct
|
|
38
|
+
# JSBigStringBuffer alias (deprecated on RN >= 0.84).
|
|
39
|
+
if(NOT DEFINED REACT_NATIVE_MINOR_VERSION)
|
|
40
|
+
execute_process(
|
|
41
|
+
COMMAND "${NODE_BINARY}" -p "require('react-native/package.json').version.split('.')[1]"
|
|
42
|
+
WORKING_DIRECTORY "${PROJECT_ROOT_DIR}/.."
|
|
43
|
+
OUTPUT_VARIABLE REACT_NATIVE_MINOR_VERSION
|
|
44
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
45
|
+
RESULT_VARIABLE _rn_minor_res
|
|
46
|
+
ERROR_QUIET
|
|
47
|
+
)
|
|
48
|
+
if(NOT _rn_minor_res EQUAL 0 OR "${REACT_NATIVE_MINOR_VERSION}" STREQUAL "")
|
|
49
|
+
message(FATAL_ERROR
|
|
50
|
+
"Failed to resolve React Native minor version with Node from '${PROJECT_ROOT_DIR}/..'. "
|
|
51
|
+
"Set REACT_NATIVE_MINOR_VERSION or NODE_BINARY explicitly."
|
|
52
|
+
)
|
|
53
|
+
endif()
|
|
54
|
+
endif()
|
|
55
|
+
|
|
37
56
|
file(GLOB LIB_CUSTOM_SRCS CONFIGURE_DEPENDS *.cpp ${LIB_COMMON_DIR}/*.cpp)
|
|
38
57
|
file(GLOB LIB_CODEGEN_SRCS CONFIGURE_DEPENDS ${LIB_ANDROID_GENERATED_JNI_DIR}/*.cpp ${LIB_ANDROID_GENERATED_COMPONENTS_DIR}/*.cpp)
|
|
39
58
|
|
|
@@ -86,4 +105,10 @@ target_include_directories(
|
|
|
86
105
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
87
106
|
)
|
|
88
107
|
|
|
108
|
+
target_compile_definitions(
|
|
109
|
+
${LIB_TARGET_NAME}
|
|
110
|
+
PRIVATE
|
|
111
|
+
REACT_NATIVE_MINOR_VERSION=${REACT_NATIVE_MINOR_VERSION}
|
|
112
|
+
)
|
|
113
|
+
|
|
89
114
|
target_compile_reactnative_options(${LIB_TARGET_NAME} PUBLIC)
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { Platform } from 'react-native';
|
|
3
4
|
export class Transformer {
|
|
4
5
|
constructor(worklet) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// On web there is no UI runtime: the web TransformerTextInput runs the
|
|
7
|
+
// worklet synchronously in JS, so it doesn't need to be compiled by the
|
|
8
|
+
// worklets plugin. Native runs it on the UI thread and requires a real
|
|
9
|
+
// worklet, so keep enforcing the directive there.
|
|
10
|
+
if (Platform.OS !== 'web') {
|
|
11
|
+
const workletHash = worklet.__workletHash;
|
|
12
|
+
if (workletHash == null) {
|
|
13
|
+
throw new Error('[rntti] Transformer must be a worklet. Did you forget to add the "worklet" directive?');
|
|
14
|
+
}
|
|
8
15
|
}
|
|
9
16
|
this._worklet = worklet;
|
|
10
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Transformer","constructor","worklet","workletHash","__workletHash","Error","_worklet"],"sourceRoot":"../../src","sources":["Transformer.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["Platform","Transformer","constructor","worklet","OS","workletHash","__workletHash","Error","_worklet"],"sourceRoot":"../../src","sources":["Transformer.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AAiBvC,OAAO,MAAMC,WAAW,CAAC;EAGvBC,WAAWA,CAACC,OAA2B,EAAE;IACvC;IACA;IACA;IACA;IACA,IAAIH,QAAQ,CAACI,EAAE,KAAK,KAAK,EAAE;MACzB,MAAMC,WAAW,GAAIF,OAAO,CAAgCG,aAAa;MACzE,IAAID,WAAW,IAAI,IAAI,EAAE;QACvB,MAAM,IAAIE,KAAK,CACb,uFACF,CAAC;MACH;IACF;IACA,IAAI,CAACC,QAAQ,GAAGL,OAAO;EACzB;EAEA,IAAIA,OAAOA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACK,QAAQ;EACtB;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useCallback","useEffect","useMemo","useRef","StyleSheet","TextInput","TransformerTextInputDecoratorViewNativeComponent","Commands","registerTransformer","unregisterTransformer","useMergeRefs","validateSelection","jsx","_jsx","TransformerTextInput","transformer","onChangeText","defaultValue","others","forwardedRef","transformerId","transformedDefaultValue","undefined","result","worklet","value","previousValue","selection","start","length","end","previousSelection","decoratorRef","textRef","setInputRef","instance","Object","assign","getValue","current","update","transform","nativeRef","newSelection","newValue","clear","inputRef","handleChangeText","text","ref","style","styles","decorator","children","create","display"],"sourceRoot":"../../src","sources":["TransformerTextInput.tsx"],"mappings":";;AAAA,SACEA,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,QAGD,OAAO;AACd,
|
|
1
|
+
{"version":3,"names":["forwardRef","useCallback","useEffect","useMemo","useRef","StyleSheet","TextInput","TransformerTextInputDecoratorViewNativeComponent","Commands","registerTransformer","unregisterTransformer","useMergeRefs","validateSelection","jsx","_jsx","TransformerTextInput","transformer","onChangeText","defaultValue","others","forwardedRef","transformerId","transformedDefaultValue","undefined","result","worklet","value","previousValue","selection","start","length","end","previousSelection","decoratorRef","textRef","setInputRef","instance","Object","assign","getValue","current","update","transform","nativeRef","newSelection","newValue","clear","inputRef","handleChangeText","text","ref","style","styles","decorator","children","create","display"],"sourceRoot":"../../src","sources":["TransformerTextInput.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["TransformerTextInput.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useCallback, useMemo, useRef } from 'react';
|
|
4
|
+
import { TextInput } from 'react-native';
|
|
5
|
+
import { computeUncontrolledSelection, validateSelection } from "./selection.js";
|
|
6
|
+
import useMergeRefs from "./utils/useMergeRefs.js";
|
|
7
|
+
|
|
8
|
+
// The web host node is a DOM input; type only the bits we use so the library's
|
|
9
|
+
// tsconfig doesn't need the `dom` lib.
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
// Web implementation. There is no UI thread, so instead of the native decorator
|
|
12
|
+
// running the transformer worklet on the UI runtime, we run the same transformer
|
|
13
|
+
// synchronously in JS on every change. The input is uncontrolled: the formatted
|
|
14
|
+
// value and caret are written straight to the DOM node in the change handler
|
|
15
|
+
// (mirroring the native side's imperative update), so there's no React
|
|
16
|
+
// re-render and no intermediate paint where the caret jumps to the end. Web is
|
|
17
|
+
// single-threaded, so value and selection land together in one step.
|
|
18
|
+
export const TransformerTextInput = /*#__PURE__*/forwardRef(({
|
|
19
|
+
transformer,
|
|
20
|
+
onChangeText,
|
|
21
|
+
defaultValue,
|
|
22
|
+
...others
|
|
23
|
+
}, forwardedRef) => {
|
|
24
|
+
const transformedDefaultValue = useMemo(() => {
|
|
25
|
+
if (defaultValue == null) {
|
|
26
|
+
return '';
|
|
27
|
+
}
|
|
28
|
+
const result = transformer.worklet({
|
|
29
|
+
value: defaultValue,
|
|
30
|
+
previousValue: defaultValue,
|
|
31
|
+
selection: {
|
|
32
|
+
start: defaultValue.length,
|
|
33
|
+
end: defaultValue.length
|
|
34
|
+
},
|
|
35
|
+
previousSelection: {
|
|
36
|
+
start: 0,
|
|
37
|
+
end: 0
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return result?.value ?? defaultValue;
|
|
41
|
+
}, [defaultValue, transformer]);
|
|
42
|
+
const valueRef = useRef(transformedDefaultValue);
|
|
43
|
+
const previousRef = useRef({
|
|
44
|
+
value: transformedDefaultValue,
|
|
45
|
+
selection: {
|
|
46
|
+
start: transformedDefaultValue.length,
|
|
47
|
+
end: transformedDefaultValue.length
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const nodeRef = useRef(null);
|
|
51
|
+
const applyTransform = useCallback((rawValue, rawSelection, transform) => {
|
|
52
|
+
const prev = previousRef.current;
|
|
53
|
+
const result = transform ? transformer.worklet({
|
|
54
|
+
value: rawValue,
|
|
55
|
+
previousValue: prev.value,
|
|
56
|
+
selection: rawSelection,
|
|
57
|
+
previousSelection: prev.selection
|
|
58
|
+
}) : null;
|
|
59
|
+
const newValue = result?.value ?? rawValue;
|
|
60
|
+
let newSelection;
|
|
61
|
+
if (result?.selection != null) {
|
|
62
|
+
newSelection = result.selection;
|
|
63
|
+
validateSelection(newSelection, newValue.length);
|
|
64
|
+
} else {
|
|
65
|
+
newSelection = computeUncontrolledSelection(rawValue, newValue, rawSelection.start, rawSelection.end);
|
|
66
|
+
}
|
|
67
|
+
previousRef.current = {
|
|
68
|
+
value: newValue,
|
|
69
|
+
selection: newSelection
|
|
70
|
+
};
|
|
71
|
+
valueRef.current = newValue;
|
|
72
|
+
// Write straight to the DOM node — uncontrolled, no React re-render.
|
|
73
|
+
const node = nodeRef.current;
|
|
74
|
+
if (node != null) {
|
|
75
|
+
node.value = newValue;
|
|
76
|
+
if (typeof node.setSelectionRange === 'function') {
|
|
77
|
+
node.setSelectionRange(newSelection.start, newSelection.end);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return newValue;
|
|
81
|
+
}, [transformer]);
|
|
82
|
+
const handleChangeText = useCallback(text => {
|
|
83
|
+
// On web the DOM caret sits right after the edit when onChangeText
|
|
84
|
+
// fires; read it so the transformer can map it like the native side.
|
|
85
|
+
const node = nodeRef.current;
|
|
86
|
+
const rawSelection = node != null && typeof node.selectionStart === 'number' ? {
|
|
87
|
+
start: node.selectionStart,
|
|
88
|
+
end: node.selectionEnd ?? node.selectionStart
|
|
89
|
+
} : {
|
|
90
|
+
start: text.length,
|
|
91
|
+
end: text.length
|
|
92
|
+
};
|
|
93
|
+
const newValue = applyTransform(text, rawSelection, true);
|
|
94
|
+
onChangeText?.(newValue);
|
|
95
|
+
}, [applyTransform, onChangeText]);
|
|
96
|
+
const setInputRef = useCallback(instance => {
|
|
97
|
+
nodeRef.current = instance;
|
|
98
|
+
if (instance != null) {
|
|
99
|
+
Object.assign(instance, {
|
|
100
|
+
getValue() {
|
|
101
|
+
return valueRef.current;
|
|
102
|
+
},
|
|
103
|
+
update({
|
|
104
|
+
value: nextValue,
|
|
105
|
+
selection,
|
|
106
|
+
transform
|
|
107
|
+
}) {
|
|
108
|
+
const base = nextValue ?? valueRef.current;
|
|
109
|
+
const sel = selection ?? {
|
|
110
|
+
start: base.length,
|
|
111
|
+
end: base.length
|
|
112
|
+
};
|
|
113
|
+
applyTransform(base, sel, transform ?? true);
|
|
114
|
+
},
|
|
115
|
+
clear() {
|
|
116
|
+
this.update({
|
|
117
|
+
value: '',
|
|
118
|
+
transform: false
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}, [applyTransform]);
|
|
124
|
+
const inputRef = useMergeRefs(setInputRef, forwardedRef);
|
|
125
|
+
return /*#__PURE__*/_jsx(TextInput
|
|
126
|
+
// @ts-expect-error web host node carries the instance methods
|
|
127
|
+
, {
|
|
128
|
+
ref: inputRef,
|
|
129
|
+
defaultValue: transformedDefaultValue,
|
|
130
|
+
onChangeText: handleChangeText,
|
|
131
|
+
...others
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
//# sourceMappingURL=TransformerTextInput.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useCallback","useMemo","useRef","TextInput","computeUncontrolledSelection","validateSelection","useMergeRefs","jsx","_jsx","TransformerTextInput","transformer","onChangeText","defaultValue","others","forwardedRef","transformedDefaultValue","result","worklet","value","previousValue","selection","start","length","end","previousSelection","valueRef","previousRef","nodeRef","applyTransform","rawValue","rawSelection","transform","prev","current","newValue","newSelection","node","setSelectionRange","handleChangeText","text","selectionStart","selectionEnd","setInputRef","instance","Object","assign","getValue","update","nextValue","base","sel","clear","inputRef","ref"],"sourceRoot":"../../src","sources":["TransformerTextInput.web.tsx"],"mappings":"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","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Transformer","TransformerTextInput"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SACEA,WAAW,QAGN,kBAAe;AACtB,SACEC,oBAAoB,QAGf,
|
|
1
|
+
{"version":3,"names":["Transformer","TransformerTextInput"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SACEA,WAAW,QAGN,kBAAe;AACtB,SACEC,oBAAoB,QAGf,wBAAwB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transformer.d.ts","sourceRoot":"","sources":["../../../src/Transformer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Transformer.d.ts","sourceRoot":"","sources":["../../../src/Transformer.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,EAAE,SAAS,CAAC;CAC9B,KACG;IACE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CAC9B,GACD,IAAI,GACJ,SAAS,CAAC;AAEd,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;gBAElC,OAAO,EAAE,kBAAkB;IAgBvC,IAAI,OAAO,uBAEV;CACF"}
|
|
@@ -1,42 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
type TransformerTextInputInstanceMethods = {
|
|
4
|
-
/**
|
|
5
|
-
* Get the current text value.
|
|
6
|
-
*/
|
|
7
|
-
getValue: () => string;
|
|
8
|
-
/**
|
|
9
|
-
* Update the value and/or selection, optionally running the transformer.
|
|
10
|
-
*/
|
|
11
|
-
update: (options: {
|
|
12
|
-
/**
|
|
13
|
-
* New value to apply.
|
|
14
|
-
*/
|
|
15
|
-
value?: string | null;
|
|
16
|
-
/**
|
|
17
|
-
* Optional selection to apply alongside the value.
|
|
18
|
-
*/
|
|
19
|
-
selection?: {
|
|
20
|
-
start: number;
|
|
21
|
-
end: number;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Whether to run the transformer on update. Defaults to true.
|
|
25
|
-
*/
|
|
26
|
-
transform?: boolean;
|
|
27
|
-
}) => void;
|
|
28
|
-
/**
|
|
29
|
-
* Clear the input value without running the transformer.
|
|
30
|
-
*/
|
|
31
|
-
clear: () => void;
|
|
32
|
-
};
|
|
33
|
-
export type TransformerTextInputInstance = HostInstance & TransformerTextInputInstanceMethods;
|
|
34
|
-
export type TransformerTextInputProps = Omit<TextInputProps, 'value'> & {
|
|
35
|
-
/**
|
|
36
|
-
* Transformer instance used to sync text changes on the UI thread.
|
|
37
|
-
*/
|
|
38
|
-
transformer: Transformer;
|
|
39
|
-
};
|
|
1
|
+
import { type TransformerTextInputInstance } from './TransformerTextInput.types';
|
|
2
|
+
export type { TransformerTextInputInstance, TransformerTextInputProps, } from './TransformerTextInput.types';
|
|
40
3
|
export declare const TransformerTextInput: import("react").ForwardRefExoticComponent<Omit<Readonly<Omit<Omit<Readonly<Omit<Readonly<{
|
|
41
4
|
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => unknown) | undefined;
|
|
42
5
|
onAccessibilityTap?: (() => unknown) | undefined;
|
|
@@ -238,10 +201,6 @@ export declare const TransformerTextInput: import("react").ForwardRefExoticCompo
|
|
|
238
201
|
value?: string | undefined;
|
|
239
202
|
textAlign?: ("left" | "center" | "right") | undefined;
|
|
240
203
|
}>, never>>, "value"> & {
|
|
241
|
-
|
|
242
|
-
* Transformer instance used to sync text changes on the UI thread.
|
|
243
|
-
*/
|
|
244
|
-
transformer: Transformer;
|
|
204
|
+
transformer: import("./Transformer").Transformer;
|
|
245
205
|
} & import("react").RefAttributes<TransformerTextInputInstance>>;
|
|
246
|
-
export {};
|
|
247
206
|
//# sourceMappingURL=TransformerTextInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransformerTextInput.d.ts","sourceRoot":"","sources":["../../../src/TransformerTextInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TransformerTextInput.d.ts","sourceRoot":"","sources":["../../../src/TransformerTextInput.tsx"],"names":[],"mappings":"AAiBA,OAAO,EACL,KAAK,4BAA4B,EAGlC,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EACV,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,8BAA8B,CAAC;AAEtC,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA4GgunB,CAAC;;;;;;;;;;;gEALjwnB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type HostInstance, type TextInputProps } from 'react-native';
|
|
2
|
+
import { type Transformer } from './Transformer';
|
|
3
|
+
export type TransformerTextInputInstanceMethods = {
|
|
4
|
+
/**
|
|
5
|
+
* Get the current text value.
|
|
6
|
+
*/
|
|
7
|
+
getValue: () => string;
|
|
8
|
+
/**
|
|
9
|
+
* Update the value and/or selection, optionally running the transformer.
|
|
10
|
+
*/
|
|
11
|
+
update: (options: {
|
|
12
|
+
/**
|
|
13
|
+
* New value to apply.
|
|
14
|
+
*/
|
|
15
|
+
value?: string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Optional selection to apply alongside the value.
|
|
18
|
+
*/
|
|
19
|
+
selection?: {
|
|
20
|
+
start: number;
|
|
21
|
+
end: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Whether to run the transformer on update. Defaults to true.
|
|
25
|
+
*/
|
|
26
|
+
transform?: boolean;
|
|
27
|
+
}) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Clear the input value without running the transformer.
|
|
30
|
+
*/
|
|
31
|
+
clear: () => void;
|
|
32
|
+
};
|
|
33
|
+
export type TransformerTextInputInstance = HostInstance & TransformerTextInputInstanceMethods;
|
|
34
|
+
export type TransformerTextInputProps = Omit<TextInputProps, 'value'> & {
|
|
35
|
+
/**
|
|
36
|
+
* Transformer instance used to sync text changes on the UI thread.
|
|
37
|
+
*/
|
|
38
|
+
transformer: Transformer;
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=TransformerTextInput.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransformerTextInput.types.d.ts","sourceRoot":"","sources":["../../../src/TransformerTextInput.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,MAAM,mCAAmC,GAAG;IAChD;;OAEG;IACH,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB;;OAEG;IACH,MAAM,EAAE,CAAC,OAAO,EAAE;QAChB;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB;;WAEG;QACH,SAAS,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;QAC3C;;WAEG;QACH,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,KAAK,IAAI,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,YAAY,GACrD,mCAAmC,CAAC;AAEtC,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG;IACtE;;OAEG;IACH,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { type TransformerTextInputInstance } from './TransformerTextInput.types';
|
|
2
|
+
export type { TransformerTextInputInstance, TransformerTextInputProps, } from './TransformerTextInput.types';
|
|
3
|
+
export declare const TransformerTextInput: import("react").ForwardRefExoticComponent<Omit<Readonly<Omit<Omit<Readonly<Omit<Readonly<{
|
|
4
|
+
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => unknown) | undefined;
|
|
5
|
+
onAccessibilityTap?: (() => unknown) | undefined;
|
|
6
|
+
onLayout?: ((event: import("react-native").LayoutChangeEvent) => unknown) | undefined;
|
|
7
|
+
onMagicTap?: (() => unknown) | undefined;
|
|
8
|
+
onAccessibilityEscape?: (() => unknown) | undefined;
|
|
9
|
+
}>, "onMoveShouldSetResponder" | "onMoveShouldSetResponderCapture" | "onResponderGrant" | "onResponderMove" | "onResponderReject" | "onResponderRelease" | "onResponderStart" | "onResponderEnd" | "onResponderTerminate" | "onResponderTerminationRequest" | "onStartShouldSetResponder" | "onStartShouldSetResponderCapture" | "onMouseEnter" | "onMouseLeave" | "onClick" | "onClickCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onBlur" | "onBlurCapture" | "onFocus" | "onFocusCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "nativeBackgroundAndroid" | "nativeForegroundAndroid" | "renderToHardwareTextureAndroid" | "hasTVPreferredFocus" | "nextFocusDown" | "nextFocusForward" | "nextFocusLeft" | "nextFocusRight" | "nextFocusUp" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "style" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
10
|
+
onMoveShouldSetResponder?: ((e: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
11
|
+
onMoveShouldSetResponderCapture?: ((e: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
12
|
+
onResponderGrant?: ((e: import("react-native").GestureResponderEvent) => void | boolean) | undefined;
|
|
13
|
+
onResponderMove?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
14
|
+
onResponderReject?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
15
|
+
onResponderRelease?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
16
|
+
onResponderStart?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
17
|
+
onResponderEnd?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
18
|
+
onResponderTerminate?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
19
|
+
onResponderTerminationRequest?: ((e: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
20
|
+
onStartShouldSetResponder?: ((e: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
21
|
+
onStartShouldSetResponderCapture?: ((e: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
22
|
+
}>, "onMouseEnter" | "onMouseLeave" | "onClick" | "onClickCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onBlur" | "onBlurCapture" | "onFocus" | "onFocusCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "nativeBackgroundAndroid" | "nativeForegroundAndroid" | "renderToHardwareTextureAndroid" | "hasTVPreferredFocus" | "nextFocusDown" | "nextFocusForward" | "nextFocusLeft" | "nextFocusRight" | "nextFocusUp" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "style" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
23
|
+
onMouseEnter?: ((event: import("react-native").MouseEvent) => void) | undefined;
|
|
24
|
+
onMouseLeave?: ((event: import("react-native").MouseEvent) => void) | undefined;
|
|
25
|
+
}>, "onClick" | "onClickCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onBlur" | "onBlurCapture" | "onFocus" | "onFocusCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "nativeBackgroundAndroid" | "nativeForegroundAndroid" | "renderToHardwareTextureAndroid" | "hasTVPreferredFocus" | "nextFocusDown" | "nextFocusForward" | "nextFocusLeft" | "nextFocusRight" | "nextFocusUp" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "style" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
26
|
+
onClick?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
27
|
+
onClickCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
28
|
+
onPointerEnter?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
29
|
+
onPointerEnterCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
30
|
+
onPointerLeave?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
31
|
+
onPointerLeaveCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
32
|
+
onPointerMove?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
33
|
+
onPointerMoveCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
34
|
+
onPointerCancel?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
35
|
+
onPointerCancelCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
36
|
+
onPointerDown?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
37
|
+
onPointerDownCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
38
|
+
onPointerUp?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
39
|
+
onPointerUpCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
40
|
+
onPointerOver?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
41
|
+
onPointerOverCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
42
|
+
onPointerOut?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
43
|
+
onPointerOutCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
44
|
+
onGotPointerCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
45
|
+
onGotPointerCaptureCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
46
|
+
onLostPointerCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
47
|
+
onLostPointerCaptureCapture?: ((e: import("react-native").PointerEvent) => void) | undefined;
|
|
48
|
+
}>, "onClick" | "onBlur" | "onBlurCapture" | "onFocus" | "onFocusCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "nativeBackgroundAndroid" | "nativeForegroundAndroid" | "renderToHardwareTextureAndroid" | "hasTVPreferredFocus" | "nextFocusDown" | "nextFocusForward" | "nextFocusLeft" | "nextFocusRight" | "nextFocusUp" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "style" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
49
|
+
onBlur?: ((event: import("react-native").BlurEvent) => void) | undefined;
|
|
50
|
+
onBlurCapture?: ((event: import("react-native").BlurEvent) => void) | undefined;
|
|
51
|
+
onFocus?: ((event: import("react-native").FocusEvent) => void) | undefined;
|
|
52
|
+
onFocusCapture?: ((event: import("react-native").FocusEvent) => void) | undefined;
|
|
53
|
+
}>, "onClick" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "nativeBackgroundAndroid" | "nativeForegroundAndroid" | "renderToHardwareTextureAndroid" | "hasTVPreferredFocus" | "nextFocusDown" | "nextFocusForward" | "nextFocusLeft" | "nextFocusRight" | "nextFocusUp" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "style" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
54
|
+
onTouchCancel?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
55
|
+
onTouchCancelCapture?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
56
|
+
onTouchEnd?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
57
|
+
onTouchEndCapture?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
58
|
+
onTouchMove?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
59
|
+
onTouchMoveCapture?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
60
|
+
onTouchStart?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
61
|
+
onTouchStartCapture?: ((e: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
62
|
+
}>, "onClick" | "nativeBackgroundAndroid" | "nativeForegroundAndroid" | "renderToHardwareTextureAndroid" | "hasTVPreferredFocus" | "nextFocusDown" | "nextFocusForward" | "nextFocusLeft" | "nextFocusRight" | "nextFocusUp" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "style" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
63
|
+
nativeBackgroundAndroid?: import("react-native/types_generated/Libraries/Components/View/ViewPropTypes").AndroidDrawable | undefined;
|
|
64
|
+
nativeForegroundAndroid?: import("react-native/types_generated/Libraries/Components/View/ViewPropTypes").AndroidDrawable | undefined;
|
|
65
|
+
renderToHardwareTextureAndroid?: boolean | undefined;
|
|
66
|
+
hasTVPreferredFocus?: boolean | undefined;
|
|
67
|
+
nextFocusDown?: number | undefined;
|
|
68
|
+
nextFocusForward?: number | undefined;
|
|
69
|
+
nextFocusLeft?: number | undefined;
|
|
70
|
+
nextFocusRight?: number | undefined;
|
|
71
|
+
nextFocusUp?: number | undefined;
|
|
72
|
+
focusable?: boolean | undefined;
|
|
73
|
+
tabIndex?: 0 | -1;
|
|
74
|
+
onClick?: ((event: import("react-native").GestureResponderEvent) => unknown) | undefined;
|
|
75
|
+
}>, "shouldRasterizeIOS" | "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "style" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
76
|
+
shouldRasterizeIOS?: boolean | undefined;
|
|
77
|
+
}>, "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "importantForAccessibility" | "screenReaderFocusable" | "children" | "style" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<Omit<Readonly<{
|
|
78
|
+
accessibilityLabelledBy?: (string | undefined) | (Array<string> | undefined);
|
|
79
|
+
"aria-labelledby"?: string | undefined;
|
|
80
|
+
accessibilityLiveRegion?: ("none" | "polite" | "assertive") | undefined;
|
|
81
|
+
"aria-live"?: ("polite" | "assertive" | "off") | undefined;
|
|
82
|
+
importantForAccessibility?: ("auto" | "yes" | "no" | "no-hide-descendants") | undefined;
|
|
83
|
+
screenReaderFocusable?: boolean;
|
|
84
|
+
}>, "accessibilityIgnoresInvertColors" | "accessibilityViewIsModal" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "aria-modal" | "accessibilityElementsHidden" | "accessibilityLanguage" | "accessibilityRespondsToUserInteraction" | "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden"> & Omit<Readonly<{
|
|
85
|
+
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
86
|
+
accessibilityViewIsModal?: boolean | undefined;
|
|
87
|
+
accessibilityShowsLargeContentViewer?: boolean | undefined;
|
|
88
|
+
accessibilityLargeContentTitle?: string | undefined;
|
|
89
|
+
"aria-modal"?: boolean | undefined;
|
|
90
|
+
accessibilityElementsHidden?: boolean | undefined;
|
|
91
|
+
accessibilityLanguage?: string | undefined;
|
|
92
|
+
accessibilityRespondsToUserInteraction?: boolean | undefined;
|
|
93
|
+
}>, "accessible" | "accessibilityLabel" | "accessibilityHint" | "aria-label" | "accessibilityRole" | "role" | "accessibilityState" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "accessibilityActions" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "aria-hidden"> & {
|
|
94
|
+
accessible?: boolean | undefined;
|
|
95
|
+
accessibilityLabel?: string | undefined;
|
|
96
|
+
accessibilityHint?: string | undefined;
|
|
97
|
+
"aria-label"?: string | undefined;
|
|
98
|
+
accessibilityRole?: import("react-native").AccessibilityRole | undefined;
|
|
99
|
+
role?: import("react-native").Role | undefined;
|
|
100
|
+
accessibilityState?: import("react-native").AccessibilityState | undefined;
|
|
101
|
+
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
102
|
+
"aria-valuemax"?: import("react-native").AccessibilityValue["max"] | undefined;
|
|
103
|
+
"aria-valuemin"?: import("react-native").AccessibilityValue["min"] | undefined;
|
|
104
|
+
"aria-valuenow"?: import("react-native").AccessibilityValue["now"] | undefined;
|
|
105
|
+
"aria-valuetext"?: import("react-native").AccessibilityValue["text"] | undefined;
|
|
106
|
+
accessibilityActions?: ReadonlyArray<import("react-native/types_generated/Libraries/Components/View/ViewAccessibility").AccessibilityActionInfo> | undefined;
|
|
107
|
+
"aria-busy"?: boolean | undefined;
|
|
108
|
+
"aria-checked"?: (boolean | undefined) | "mixed";
|
|
109
|
+
"aria-disabled"?: boolean | undefined;
|
|
110
|
+
"aria-expanded"?: boolean | undefined;
|
|
111
|
+
"aria-selected"?: boolean | undefined;
|
|
112
|
+
"aria-hidden"?: boolean | undefined;
|
|
113
|
+
}>, "children" | "style" | "collapsable" | "collapsableChildren" | "id" | "testID" | "nativeID" | "needsOffscreenAlphaCompositing" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "experimental_accessibilityOrder"> & Omit<Readonly<{
|
|
114
|
+
children?: React.ReactNode;
|
|
115
|
+
style?: import("react-native/types_generated/Libraries/StyleSheet/StyleSheet").ViewStyleProp | undefined;
|
|
116
|
+
collapsable?: boolean | undefined;
|
|
117
|
+
collapsableChildren?: boolean | undefined;
|
|
118
|
+
id?: string;
|
|
119
|
+
testID?: string | undefined;
|
|
120
|
+
nativeID?: string | undefined;
|
|
121
|
+
needsOffscreenAlphaCompositing?: boolean | undefined;
|
|
122
|
+
hitSlop?: import("react-native/types_generated/Libraries/StyleSheet/EdgeInsetsPropType").EdgeInsetsOrSizeProp | undefined;
|
|
123
|
+
pointerEvents?: ("auto" | "box-none" | "box-only" | "none") | undefined;
|
|
124
|
+
removeClippedSubviews?: boolean | undefined;
|
|
125
|
+
experimental_accessibilityOrder?: Array<string> | undefined;
|
|
126
|
+
}>, never>>, "style" | "experimental_accessibilityOrder">, "onBlur" | "onFocus" | "style" | "selection" | "disableKeyboardShortcuts" | "clearButtonMode" | "clearTextOnFocus" | "dataDetectorTypes" | "enablesReturnKeyAutomatically" | "inputAccessoryViewID" | "inputAccessoryViewButtonLabel" | "keyboardAppearance" | "passwordRules" | "rejectResponderTermination" | "scrollEnabled" | "spellCheck" | "textContentType" | "lineBreakStrategyIOS" | "lineBreakModeIOS" | "smartInsertDelete" | "cursorColor" | "selectionHandleColor" | "disableFullscreenUI" | "importantForAutofill" | "inlineImageLeft" | "inlineImagePadding" | "numberOfLines" | "returnKeyLabel" | "rows" | "showSoftInputOnFocus" | "textBreakStrategy" | "underlineColorAndroid" | "experimental_acceptDragAndDropTypes" | "autoCapitalize" | "autoComplete" | "autoCorrect" | "autoFocus" | "allowFontScaling" | "caretHidden" | "contextMenuHidden" | "defaultValue" | "editable" | "forwardedRef" | "enterKeyHint" | "inputMode" | "keyboardType" | "maxFontSizeMultiplier" | "maxLength" | "multiline" | "onChange" | "onChangeText" | "onContentSizeChange" | "onEndEditing" | "onKeyPress" | "onPress" | "onPressIn" | "onPressOut" | "onSelectionChange" | "onSubmitEditing" | "onScroll" | "placeholder" | "placeholderTextColor" | "readOnly" | "returnKeyType" | "secureTextEntry" | "selectionColor" | "selectTextOnFocus" | "blurOnSubmit" | "submitBehavior" | "value" | "textAlign"> & Omit<Readonly<{
|
|
127
|
+
disableKeyboardShortcuts?: boolean | undefined;
|
|
128
|
+
clearButtonMode?: ("never" | "while-editing" | "unless-editing" | "always") | undefined;
|
|
129
|
+
clearTextOnFocus?: boolean | undefined;
|
|
130
|
+
dataDetectorTypes?: (import("react-native/types_generated/Libraries/Components/TextInput/TextInput.flow").DataDetectorTypesType | undefined) | ReadonlyArray<import("react-native/types_generated/Libraries/Components/TextInput/TextInput.flow").DataDetectorTypesType>;
|
|
131
|
+
enablesReturnKeyAutomatically?: boolean | undefined;
|
|
132
|
+
inputAccessoryViewID?: string | undefined;
|
|
133
|
+
inputAccessoryViewButtonLabel?: string | undefined;
|
|
134
|
+
keyboardAppearance?: ("default" | "light" | "dark") | undefined;
|
|
135
|
+
passwordRules?: import("react-native/types_generated/Libraries/Components/TextInput/TextInput.flow").PasswordRules | undefined;
|
|
136
|
+
rejectResponderTermination?: boolean | undefined;
|
|
137
|
+
scrollEnabled?: boolean | undefined;
|
|
138
|
+
spellCheck?: boolean | undefined;
|
|
139
|
+
textContentType?: import("react-native").TextContentType | undefined;
|
|
140
|
+
lineBreakStrategyIOS?: ("none" | "standard" | "hangul-word" | "push-out") | undefined;
|
|
141
|
+
lineBreakModeIOS?: ("wordWrapping" | "char" | "clip" | "head" | "middle" | "tail") | undefined;
|
|
142
|
+
smartInsertDelete?: boolean | undefined;
|
|
143
|
+
}>, "onBlur" | "onFocus" | "style" | "selection" | "cursorColor" | "selectionHandleColor" | "disableFullscreenUI" | "importantForAutofill" | "inlineImageLeft" | "inlineImagePadding" | "numberOfLines" | "returnKeyLabel" | "rows" | "showSoftInputOnFocus" | "textBreakStrategy" | "underlineColorAndroid" | "experimental_acceptDragAndDropTypes" | "autoCapitalize" | "autoComplete" | "autoCorrect" | "autoFocus" | "allowFontScaling" | "caretHidden" | "contextMenuHidden" | "defaultValue" | "editable" | "forwardedRef" | "enterKeyHint" | "inputMode" | "keyboardType" | "maxFontSizeMultiplier" | "maxLength" | "multiline" | "onChange" | "onChangeText" | "onContentSizeChange" | "onEndEditing" | "onKeyPress" | "onPress" | "onPressIn" | "onPressOut" | "onSelectionChange" | "onSubmitEditing" | "onScroll" | "placeholder" | "placeholderTextColor" | "readOnly" | "returnKeyType" | "secureTextEntry" | "selectionColor" | "selectTextOnFocus" | "blurOnSubmit" | "submitBehavior" | "value" | "textAlign"> & Omit<Readonly<{
|
|
144
|
+
cursorColor?: import("react-native").ColorValue | undefined;
|
|
145
|
+
selectionHandleColor?: import("react-native").ColorValue | undefined;
|
|
146
|
+
disableFullscreenUI?: boolean | undefined;
|
|
147
|
+
importantForAutofill?: ("auto" | "no" | "noExcludeDescendants" | "yes" | "yesExcludeDescendants") | undefined;
|
|
148
|
+
inlineImageLeft?: string | undefined;
|
|
149
|
+
inlineImagePadding?: number | undefined;
|
|
150
|
+
numberOfLines?: number | undefined;
|
|
151
|
+
returnKeyLabel?: string | undefined;
|
|
152
|
+
rows?: number | undefined;
|
|
153
|
+
showSoftInputOnFocus?: boolean | undefined;
|
|
154
|
+
textBreakStrategy?: ("simple" | "highQuality" | "balanced") | undefined;
|
|
155
|
+
underlineColorAndroid?: import("react-native").ColorValue | undefined;
|
|
156
|
+
}>, "onBlur" | "onFocus" | "style" | "selection" | "experimental_acceptDragAndDropTypes" | "autoCapitalize" | "autoComplete" | "autoCorrect" | "autoFocus" | "allowFontScaling" | "caretHidden" | "contextMenuHidden" | "defaultValue" | "editable" | "forwardedRef" | "enterKeyHint" | "inputMode" | "keyboardType" | "maxFontSizeMultiplier" | "maxLength" | "multiline" | "onChange" | "onChangeText" | "onContentSizeChange" | "onEndEditing" | "onKeyPress" | "onPress" | "onPressIn" | "onPressOut" | "onSelectionChange" | "onSubmitEditing" | "onScroll" | "placeholder" | "placeholderTextColor" | "readOnly" | "returnKeyType" | "secureTextEntry" | "selectionColor" | "selectTextOnFocus" | "blurOnSubmit" | "submitBehavior" | "value" | "textAlign"> & Omit<Readonly<{
|
|
157
|
+
experimental_acceptDragAndDropTypes?: ReadonlyArray<string> | undefined;
|
|
158
|
+
autoCapitalize?: import("react-native").AutoCapitalize | undefined;
|
|
159
|
+
autoComplete?: ("additional-name" | "address-line1" | "address-line2" | "birthdate-day" | "birthdate-full" | "birthdate-month" | "birthdate-year" | "cc-csc" | "cc-exp" | "cc-exp-day" | "cc-exp-month" | "cc-exp-year" | "cc-number" | "cc-name" | "cc-given-name" | "cc-middle-name" | "cc-family-name" | "cc-type" | "country" | "current-password" | "email" | "family-name" | "gender" | "given-name" | "honorific-prefix" | "honorific-suffix" | "name" | "name-family" | "name-given" | "name-middle" | "name-middle-initial" | "name-prefix" | "name-suffix" | "new-password" | "nickname" | "one-time-code" | "organization" | "organization-title" | "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" | "url" | "username" | "username-new" | "off") | undefined;
|
|
160
|
+
autoCorrect?: boolean | undefined;
|
|
161
|
+
autoFocus?: boolean | undefined;
|
|
162
|
+
allowFontScaling?: boolean | undefined;
|
|
163
|
+
caretHidden?: boolean | undefined;
|
|
164
|
+
contextMenuHidden?: boolean | undefined;
|
|
165
|
+
defaultValue?: string | undefined;
|
|
166
|
+
editable?: boolean | undefined;
|
|
167
|
+
forwardedRef?: React.Ref<import("react-native/types_generated/Libraries/Components/TextInput/TextInput.flow").TextInputInstance> | undefined;
|
|
168
|
+
enterKeyHint?: import("react-native").EnterKeyHintTypeOptions | undefined;
|
|
169
|
+
inputMode?: import("react-native").InputModeOptions | undefined;
|
|
170
|
+
keyboardType?: import("react-native").KeyboardTypeOptions | undefined;
|
|
171
|
+
maxFontSizeMultiplier?: number | undefined;
|
|
172
|
+
maxLength?: number | undefined;
|
|
173
|
+
multiline?: boolean | undefined;
|
|
174
|
+
onBlur?: ((e: import("react-native/types_generated/Libraries/Components/TextInput/TextInput.flow").TextInputBlurEvent) => unknown) | undefined;
|
|
175
|
+
onChange?: ((e: import("react-native").TextInputChangeEvent) => unknown) | undefined;
|
|
176
|
+
onChangeText?: ((text: string) => unknown) | undefined;
|
|
177
|
+
onContentSizeChange?: ((e: import("react-native").TextInputContentSizeChangeEvent) => unknown) | undefined;
|
|
178
|
+
onEndEditing?: ((e: import("react-native").TextInputEndEditingEvent) => unknown) | undefined;
|
|
179
|
+
onFocus?: ((e: import("react-native").TextInputFocusEvent) => unknown) | undefined;
|
|
180
|
+
onKeyPress?: ((e: import("react-native").TextInputKeyPressEvent) => unknown) | undefined;
|
|
181
|
+
onPress?: ((event: import("react-native").GestureResponderEvent) => unknown) | undefined;
|
|
182
|
+
onPressIn?: ((event: import("react-native").GestureResponderEvent) => unknown) | undefined;
|
|
183
|
+
onPressOut?: ((event: import("react-native").GestureResponderEvent) => unknown) | undefined;
|
|
184
|
+
onSelectionChange?: ((e: import("react-native").TextInputSelectionChangeEvent) => unknown) | undefined;
|
|
185
|
+
onSubmitEditing?: ((e: import("react-native").TextInputSubmitEditingEvent) => unknown) | undefined;
|
|
186
|
+
onScroll?: ((e: import("react-native").ScrollEvent) => unknown) | undefined;
|
|
187
|
+
placeholder?: string | undefined;
|
|
188
|
+
placeholderTextColor?: import("react-native").ColorValue | undefined;
|
|
189
|
+
readOnly?: boolean | undefined;
|
|
190
|
+
returnKeyType?: import("react-native").ReturnKeyTypeOptions | undefined;
|
|
191
|
+
secureTextEntry?: boolean | undefined;
|
|
192
|
+
selection?: Readonly<{
|
|
193
|
+
start: number;
|
|
194
|
+
end?: number | undefined;
|
|
195
|
+
}> | undefined;
|
|
196
|
+
selectionColor?: import("react-native").ColorValue | undefined;
|
|
197
|
+
selectTextOnFocus?: boolean | undefined;
|
|
198
|
+
blurOnSubmit?: boolean | undefined;
|
|
199
|
+
submitBehavior?: import("react-native").SubmitBehavior | undefined;
|
|
200
|
+
style?: import("react-native/types_generated/Libraries/StyleSheet/StyleSheet").TextStyleProp | undefined;
|
|
201
|
+
value?: string | undefined;
|
|
202
|
+
textAlign?: ("left" | "center" | "right") | undefined;
|
|
203
|
+
}>, never>>, "value"> & {
|
|
204
|
+
transformer: import("./Transformer").Transformer;
|
|
205
|
+
} & import("react").RefAttributes<TransformerTextInputInstance>>;
|
|
206
|
+
//# sourceMappingURL=TransformerTextInput.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransformerTextInput.web.d.ts","sourceRoot":"","sources":["../../../src/TransformerTextInput.web.tsx"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,4BAA4B,EAGlC,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EACV,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,8BAA8B,CAAC;AAkBtC,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAiIspkB,CAAC;;;;;;;;;;;gEADvrkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-transformer-text-input",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "TextInput component that allows transforming text synchronously with a worklet",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"prepare": "bob build",
|
|
58
58
|
"generate:phone-data": "tsx scripts/generate-phone-data.ts",
|
|
59
59
|
"test": "jest",
|
|
60
|
-
"lint": "yarn lint:eslint && yarn lint:ts
|
|
60
|
+
"lint": "yarn lint:eslint && yarn lint:ts",
|
|
61
61
|
"lint:ts": "tsc",
|
|
62
62
|
"lint:eslint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
63
63
|
"lint:android": "cd example/android && RNTTI_WARNINGS_AS_ERRORS=true ./gradlew :react-native-transformer-text-input:lint --rerun-tasks",
|
package/src/Transformer.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
1
3
|
export type Selection = { start: number; end: number };
|
|
2
4
|
|
|
3
5
|
export type TransformerWorklet = (input: {
|
|
@@ -17,11 +19,17 @@ export class Transformer {
|
|
|
17
19
|
private readonly _worklet: TransformerWorklet;
|
|
18
20
|
|
|
19
21
|
constructor(worklet: TransformerWorklet) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
// On web there is no UI runtime: the web TransformerTextInput runs the
|
|
23
|
+
// worklet synchronously in JS, so it doesn't need to be compiled by the
|
|
24
|
+
// worklets plugin. Native runs it on the UI thread and requires a real
|
|
25
|
+
// worklet, so keep enforcing the directive there.
|
|
26
|
+
if (Platform.OS !== 'web') {
|
|
27
|
+
const workletHash = (worklet as { __workletHash?: number }).__workletHash;
|
|
28
|
+
if (workletHash == null) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
'[rntti] Transformer must be a worklet. Did you forget to add the "worklet" directive?',
|
|
31
|
+
);
|
|
32
|
+
}
|
|
25
33
|
}
|
|
26
34
|
this._worklet = worklet;
|
|
27
35
|
}
|
|
@@ -7,57 +7,24 @@ import {
|
|
|
7
7
|
type ElementRef,
|
|
8
8
|
type Ref,
|
|
9
9
|
} from 'react';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
TextInput,
|
|
13
|
-
type HostInstance,
|
|
14
|
-
type TextInputProps,
|
|
15
|
-
} from 'react-native';
|
|
16
|
-
import { type Selection, type Transformer } from './Transformer';
|
|
10
|
+
import { StyleSheet, TextInput, type HostInstance } from 'react-native';
|
|
11
|
+
import { type Selection } from './Transformer';
|
|
17
12
|
import TransformerTextInputDecoratorViewNativeComponent, {
|
|
18
13
|
Commands,
|
|
19
14
|
} from './TransformerTextInputDecoratorViewNativeComponent';
|
|
20
15
|
import { registerTransformer, unregisterTransformer } from './registry';
|
|
21
16
|
import useMergeRefs from './utils/useMergeRefs';
|
|
22
17
|
import { validateSelection } from './selection';
|
|
18
|
+
import {
|
|
19
|
+
type TransformerTextInputInstance,
|
|
20
|
+
type TransformerTextInputInstanceMethods,
|
|
21
|
+
type TransformerTextInputProps,
|
|
22
|
+
} from './TransformerTextInput.types';
|
|
23
23
|
|
|
24
|
-
type
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
getValue: () => string;
|
|
29
|
-
/**
|
|
30
|
-
* Update the value and/or selection, optionally running the transformer.
|
|
31
|
-
*/
|
|
32
|
-
update: (options: {
|
|
33
|
-
/**
|
|
34
|
-
* New value to apply.
|
|
35
|
-
*/
|
|
36
|
-
value?: string | null;
|
|
37
|
-
/**
|
|
38
|
-
* Optional selection to apply alongside the value.
|
|
39
|
-
*/
|
|
40
|
-
selection?: { start: number; end: number };
|
|
41
|
-
/**
|
|
42
|
-
* Whether to run the transformer on update. Defaults to true.
|
|
43
|
-
*/
|
|
44
|
-
transform?: boolean;
|
|
45
|
-
}) => void;
|
|
46
|
-
/**
|
|
47
|
-
* Clear the input value without running the transformer.
|
|
48
|
-
*/
|
|
49
|
-
clear: () => void;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export type TransformerTextInputInstance = HostInstance &
|
|
53
|
-
TransformerTextInputInstanceMethods;
|
|
54
|
-
|
|
55
|
-
export type TransformerTextInputProps = Omit<TextInputProps, 'value'> & {
|
|
56
|
-
/**
|
|
57
|
-
* Transformer instance used to sync text changes on the UI thread.
|
|
58
|
-
*/
|
|
59
|
-
transformer: Transformer;
|
|
60
|
-
};
|
|
24
|
+
export type {
|
|
25
|
+
TransformerTextInputInstance,
|
|
26
|
+
TransformerTextInputProps,
|
|
27
|
+
} from './TransformerTextInput.types';
|
|
61
28
|
|
|
62
29
|
export const TransformerTextInput = forwardRef(
|
|
63
30
|
(
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type HostInstance, type TextInputProps } from 'react-native';
|
|
2
|
+
import { type Transformer } from './Transformer';
|
|
3
|
+
|
|
4
|
+
export type TransformerTextInputInstanceMethods = {
|
|
5
|
+
/**
|
|
6
|
+
* Get the current text value.
|
|
7
|
+
*/
|
|
8
|
+
getValue: () => string;
|
|
9
|
+
/**
|
|
10
|
+
* Update the value and/or selection, optionally running the transformer.
|
|
11
|
+
*/
|
|
12
|
+
update: (options: {
|
|
13
|
+
/**
|
|
14
|
+
* New value to apply.
|
|
15
|
+
*/
|
|
16
|
+
value?: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Optional selection to apply alongside the value.
|
|
19
|
+
*/
|
|
20
|
+
selection?: { start: number; end: number };
|
|
21
|
+
/**
|
|
22
|
+
* Whether to run the transformer on update. Defaults to true.
|
|
23
|
+
*/
|
|
24
|
+
transform?: boolean;
|
|
25
|
+
}) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Clear the input value without running the transformer.
|
|
28
|
+
*/
|
|
29
|
+
clear: () => void;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type TransformerTextInputInstance = HostInstance &
|
|
33
|
+
TransformerTextInputInstanceMethods;
|
|
34
|
+
|
|
35
|
+
export type TransformerTextInputProps = Omit<TextInputProps, 'value'> & {
|
|
36
|
+
/**
|
|
37
|
+
* Transformer instance used to sync text changes on the UI thread.
|
|
38
|
+
*/
|
|
39
|
+
transformer: Transformer;
|
|
40
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { forwardRef, useCallback, useMemo, useRef, type Ref } from 'react';
|
|
2
|
+
import { TextInput } from 'react-native';
|
|
3
|
+
import { type Selection } from './Transformer';
|
|
4
|
+
import { computeUncontrolledSelection, validateSelection } from './selection';
|
|
5
|
+
import useMergeRefs from './utils/useMergeRefs';
|
|
6
|
+
import {
|
|
7
|
+
type TransformerTextInputInstance,
|
|
8
|
+
type TransformerTextInputInstanceMethods,
|
|
9
|
+
type TransformerTextInputProps,
|
|
10
|
+
} from './TransformerTextInput.types';
|
|
11
|
+
|
|
12
|
+
export type {
|
|
13
|
+
TransformerTextInputInstance,
|
|
14
|
+
TransformerTextInputProps,
|
|
15
|
+
} from './TransformerTextInput.types';
|
|
16
|
+
|
|
17
|
+
// The web host node is a DOM input; type only the bits we use so the library's
|
|
18
|
+
// tsconfig doesn't need the `dom` lib.
|
|
19
|
+
type WebInputNode = {
|
|
20
|
+
value: string;
|
|
21
|
+
selectionStart: number | null;
|
|
22
|
+
selectionEnd: number | null;
|
|
23
|
+
setSelectionRange: (start: number, end: number) => void;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// Web implementation. There is no UI thread, so instead of the native decorator
|
|
27
|
+
// running the transformer worklet on the UI runtime, we run the same transformer
|
|
28
|
+
// synchronously in JS on every change. The input is uncontrolled: the formatted
|
|
29
|
+
// value and caret are written straight to the DOM node in the change handler
|
|
30
|
+
// (mirroring the native side's imperative update), so there's no React
|
|
31
|
+
// re-render and no intermediate paint where the caret jumps to the end. Web is
|
|
32
|
+
// single-threaded, so value and selection land together in one step.
|
|
33
|
+
export const TransformerTextInput = forwardRef(
|
|
34
|
+
(
|
|
35
|
+
{
|
|
36
|
+
transformer,
|
|
37
|
+
onChangeText,
|
|
38
|
+
defaultValue,
|
|
39
|
+
...others
|
|
40
|
+
}: TransformerTextInputProps,
|
|
41
|
+
forwardedRef: Ref<TransformerTextInputInstance>,
|
|
42
|
+
) => {
|
|
43
|
+
const transformedDefaultValue = useMemo(() => {
|
|
44
|
+
if (defaultValue == null) {
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
47
|
+
const result = transformer.worklet({
|
|
48
|
+
value: defaultValue,
|
|
49
|
+
previousValue: defaultValue,
|
|
50
|
+
selection: { start: defaultValue.length, end: defaultValue.length },
|
|
51
|
+
previousSelection: { start: 0, end: 0 },
|
|
52
|
+
});
|
|
53
|
+
return result?.value ?? defaultValue;
|
|
54
|
+
}, [defaultValue, transformer]);
|
|
55
|
+
|
|
56
|
+
const valueRef = useRef(transformedDefaultValue);
|
|
57
|
+
const previousRef = useRef<{ value: string; selection: Selection }>({
|
|
58
|
+
value: transformedDefaultValue,
|
|
59
|
+
selection: {
|
|
60
|
+
start: transformedDefaultValue.length,
|
|
61
|
+
end: transformedDefaultValue.length,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
const nodeRef = useRef<WebInputNode | null>(null);
|
|
65
|
+
|
|
66
|
+
const applyTransform = useCallback(
|
|
67
|
+
(
|
|
68
|
+
rawValue: string,
|
|
69
|
+
rawSelection: Selection,
|
|
70
|
+
transform: boolean,
|
|
71
|
+
): string => {
|
|
72
|
+
const prev = previousRef.current;
|
|
73
|
+
const result = transform
|
|
74
|
+
? transformer.worklet({
|
|
75
|
+
value: rawValue,
|
|
76
|
+
previousValue: prev.value,
|
|
77
|
+
selection: rawSelection,
|
|
78
|
+
previousSelection: prev.selection,
|
|
79
|
+
})
|
|
80
|
+
: null;
|
|
81
|
+
const newValue = result?.value ?? rawValue;
|
|
82
|
+
let newSelection: Selection;
|
|
83
|
+
if (result?.selection != null) {
|
|
84
|
+
newSelection = result.selection;
|
|
85
|
+
validateSelection(newSelection, newValue.length);
|
|
86
|
+
} else {
|
|
87
|
+
newSelection = computeUncontrolledSelection(
|
|
88
|
+
rawValue,
|
|
89
|
+
newValue,
|
|
90
|
+
rawSelection.start,
|
|
91
|
+
rawSelection.end,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
previousRef.current = { value: newValue, selection: newSelection };
|
|
95
|
+
valueRef.current = newValue;
|
|
96
|
+
// Write straight to the DOM node — uncontrolled, no React re-render.
|
|
97
|
+
const node = nodeRef.current;
|
|
98
|
+
if (node != null) {
|
|
99
|
+
node.value = newValue;
|
|
100
|
+
if (typeof node.setSelectionRange === 'function') {
|
|
101
|
+
node.setSelectionRange(newSelection.start, newSelection.end);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return newValue;
|
|
105
|
+
},
|
|
106
|
+
[transformer],
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const handleChangeText = useCallback(
|
|
110
|
+
(text: string) => {
|
|
111
|
+
// On web the DOM caret sits right after the edit when onChangeText
|
|
112
|
+
// fires; read it so the transformer can map it like the native side.
|
|
113
|
+
const node = nodeRef.current;
|
|
114
|
+
const rawSelection: Selection =
|
|
115
|
+
node != null && typeof node.selectionStart === 'number'
|
|
116
|
+
? {
|
|
117
|
+
start: node.selectionStart,
|
|
118
|
+
end: node.selectionEnd ?? node.selectionStart,
|
|
119
|
+
}
|
|
120
|
+
: { start: text.length, end: text.length };
|
|
121
|
+
const newValue = applyTransform(text, rawSelection, true);
|
|
122
|
+
onChangeText?.(newValue);
|
|
123
|
+
},
|
|
124
|
+
[applyTransform, onChangeText],
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const setInputRef = useCallback(
|
|
128
|
+
(instance: TransformerTextInputInstance | null) => {
|
|
129
|
+
nodeRef.current = instance as unknown as WebInputNode | null;
|
|
130
|
+
if (instance != null) {
|
|
131
|
+
Object.assign(instance, {
|
|
132
|
+
getValue() {
|
|
133
|
+
return valueRef.current;
|
|
134
|
+
},
|
|
135
|
+
update({ value: nextValue, selection, transform }) {
|
|
136
|
+
const base = nextValue ?? valueRef.current;
|
|
137
|
+
const sel = selection ?? { start: base.length, end: base.length };
|
|
138
|
+
applyTransform(base, sel, transform ?? true);
|
|
139
|
+
},
|
|
140
|
+
clear() {
|
|
141
|
+
this.update({ value: '', transform: false });
|
|
142
|
+
},
|
|
143
|
+
} satisfies TransformerTextInputInstanceMethods);
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
[applyTransform],
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
const inputRef = useMergeRefs(setInputRef, forwardedRef);
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<TextInput
|
|
153
|
+
// @ts-expect-error web host node carries the instance methods
|
|
154
|
+
ref={inputRef}
|
|
155
|
+
defaultValue={transformedDefaultValue}
|
|
156
|
+
onChangeText={handleChangeText}
|
|
157
|
+
{...others}
|
|
158
|
+
/>
|
|
159
|
+
);
|
|
160
|
+
},
|
|
161
|
+
);
|