151 lines
7.1 KiB
TypeScript
151 lines
7.1 KiB
TypeScript
/* Metro module 6986; source: design/components/TextField/native/useTextField.native.tsx; dependencies: [57, 31, 4570, 2] */
|
|
function _fun55378(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#55378, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:6, offset: 0x013a520a, size: 148 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const closure = useTextFieldState;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('design/components/TextField/native/useTextField.native.tsx');
|
|
exports.useTextFieldState = closure;
|
|
exports.useTextField = useTextField;
|
|
}
|
|
|
|
function useTextFieldState({value, defaultValue, onChange, onClear}) { // fn#55379, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:116, offset: 0x013a529e, size: 211 bytes, params: 2, frame: 20
|
|
let binding = env0_3;
|
|
const useState = binding.useState;
|
|
let r4 = value ?? defaultValue ?? '';
|
|
const value5 = env0_2(Reflect.apply(useState, binding, [r4]), 2);
|
|
const property = value5[0];
|
|
var env0_2 = value5[1];
|
|
r4 = value ?? property;
|
|
value = r4.length > 0;
|
|
binding = env0_3;
|
|
let useCallback = binding.useCallback;
|
|
const value6 = Reflect.apply(useCallback, binding, [_fun55380, [onChange]]);
|
|
var env0_3 = value6;
|
|
binding = env0_3;
|
|
useCallback = binding.useCallback;
|
|
return {value: r4, setTextValue: value6, clear: Reflect.apply(useCallback, binding, [_fun55381, [value6, onClear]]),
|
|
hasValue: value};
|
|
}
|
|
|
|
function useTextField(a0, a1) { // fn#55382, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:587, offset: 0x013a53bd, size: 257 bytes, params: 3, frame: 19
|
|
var object3;
|
|
const env0_0 = a0;
|
|
const value2 = env0_3.useRef(null);
|
|
const value3 = env0_3.useCallback(_fun55383, [value2, a0.onClear]);
|
|
object3 = {};
|
|
copyDataProperties(object3, a0, undefined);
|
|
object3['onClear'] = value3;
|
|
const value4 = useTextFieldState(object3);
|
|
env0_3.useImperativeHandle(a1, function() {
|
|
return {blur: _fun55385, focus: _fun55386, isFocused: _fun55387, getText: _fun55388, setText: _fun55389,
|
|
measure: _fun55390, measureInWindow: _fun55391, measureLayout: _fun55392};
|
|
}, [value2, value4]);
|
|
object3 = {innerRef: value2, state: value4};
|
|
const object4 = {};
|
|
copyDataProperties(object4, a0, undefined);
|
|
object4['onChange'] = undefined;
|
|
object4['onChangeText'] = value4.setTextValue;
|
|
object4['editable'] = !a0.isDisabled;
|
|
object4['focusable'] = !a0.isDisabled && a0.focusable;
|
|
object4['aria-disabled'] = a0.isDisabled;
|
|
object3.inputProps = object4;
|
|
return object3;
|
|
}
|
|
|
|
function _fun55380(a0) { // fn#55380, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:312, offset: 0x013a5371, size: 38 bytes, params: 2, frame: 13
|
|
env0_2(a0);
|
|
if (onChange != null) {
|
|
onChange(a0);
|
|
}
|
|
}
|
|
|
|
function _fun55381() { // fn#55381, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:359, offset: 0x013a5397, size: 38 bytes, params: 1, frame: 12
|
|
env0_3('');
|
|
if (onClear != null) {
|
|
onClear();
|
|
}
|
|
}
|
|
|
|
function _fun55383() { // fn#55383, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:652, offset: 0x013a54be, size: 96 bytes, params: 1, frame: 13
|
|
const current = env0_1.current;
|
|
if (current != null) {
|
|
current.clear();
|
|
}
|
|
const onClear = env0_0.onClear;
|
|
if (onClear != null) {
|
|
onClear();
|
|
}
|
|
const setAccessibilityFocusAndroidModule = require(4570) /* metro dependency 4570: setAccessibilityFocusAndroid */;
|
|
setAccessibilityFocusAndroidModule.setAccessibilityFocus({ref: env0_1});
|
|
}
|
|
|
|
function _fun55384() { // fn#55384, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:849, offset: 0x013a551e, size: 86 bytes, params: 1, frame: 3
|
|
return {blur: blur_55385, focus: focus_55386, isFocused: isFocused_55387, getText: getText_55388,
|
|
setText: setText_55389, measure: measure_55390, measureInWindow: measureInWindow_55391,
|
|
measureLayout: measureLayout_55392};
|
|
}
|
|
|
|
function blur_55385() { // fn#55385, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:860, offset: 0x013a5574, size: 32 bytes, params: 1, frame: 9
|
|
const current = env1_1.current;
|
|
if (current != null) {
|
|
current.blur();
|
|
}
|
|
}
|
|
|
|
function focus_55386() { // fn#55386, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:908, offset: 0x013a5594, size: 32 bytes, params: 1, frame: 9
|
|
const current = env1_1.current;
|
|
if (current != null) {
|
|
current.focus();
|
|
}
|
|
}
|
|
|
|
function isFocused_55387() { // fn#55387, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:961, offset: 0x013a55b4, size: 41 bytes, params: 1, frame: 10
|
|
const value = environment.__proto__;
|
|
return env1_1.current?.isFocused() === true;
|
|
}
|
|
|
|
function getText_55388() { // fn#55388, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:1035, offset: 0x013a55dd, size: 14 bytes, params: 1, frame: 1
|
|
return env1_2.value;
|
|
}
|
|
|
|
function setText_55389(a0) { // fn#55389, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:1055, offset: 0x013a55eb, size: 84 bytes, params: 2, frame: 14
|
|
var value;
|
|
var current;
|
|
if (a0 === '') {
|
|
value = environment.__proto__;
|
|
env1_2.clear();
|
|
} else {
|
|
value = environment.__proto__;
|
|
current = env1_1.current;
|
|
if (current != null) {
|
|
current.setNativeProps({text: a0});
|
|
}
|
|
env1_2.setTextValue(a0);
|
|
}
|
|
}
|
|
|
|
function measure_55390(a0) { // fn#55390, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:1159, offset: 0x013a563f, size: 36 bytes, params: 2, frame: 11
|
|
const current = env1_1.current;
|
|
if (current != null) {
|
|
current.measure(a0);
|
|
}
|
|
}
|
|
|
|
function measureInWindow_55391(a0) { // fn#55391, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:1220, offset: 0x013a5663, size: 36 bytes, params: 2, frame: 11
|
|
const current = env1_1.current;
|
|
if (current != null) {
|
|
current.measureInWindow(a0);
|
|
}
|
|
}
|
|
|
|
function measureLayout_55392(a0, a1, a2) { // fn#55392, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7164:1287, offset: 0x013a5687, size: 44 bytes, params: 4, frame: 15
|
|
const current = env1_1.current;
|
|
if (current != null) {
|
|
current.measureLayout(a0, a1, a2);
|
|
}
|
|
}
|
|
|