152 lines
8.4 KiB
TypeScript
152 lines
8.4 KiB
TypeScript
/* Metro module 6986; source: design/components/TextField/native/useTextField.native.tsx; dependencies: [57, 31, 4570, 2] */
|
|
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as SetAccessibilityFocusAndroidModule from '../../../../modules/a11y/native/setAccessibilityFocus.android.tsx'; /* Metro dependency 4570 */
|
|
|
|
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 useTextFieldState2 = useTextFieldState;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('design/components/TextField/native/useTextField.native.tsx');
|
|
exports.useTextFieldState = useTextFieldState2;
|
|
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 _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 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
|
|
const env0_0 = a0;
|
|
const value2 = ReactModule.useRef(null);
|
|
const value3 = ReactModule.useCallback(_fun55383, [value2, a0.onClear]);
|
|
object = {};
|
|
copyDataProperties(object, a0, undefined);
|
|
object['onClear'] = value3;
|
|
const value4 = useTextFieldState(object);
|
|
ReactModule.useImperativeHandle(a1, function() {
|
|
return {blur: _fun55385, focus: _fun55386, isFocused: _fun55387, getText: _fun55388, setText: _fun55389,
|
|
measure: _fun55390, measureInWindow: _fun55391, measureLayout: _fun55392};
|
|
}, [value2, value4]);
|
|
object = {innerRef: value2, state: value4};
|
|
const object2 = {};
|
|
copyDataProperties(object2, a0, undefined);
|
|
object2['onChange'] = undefined;
|
|
object2['onChangeText'] = value4.setTextValue;
|
|
object2['editable'] = !a0.isDisabled;
|
|
object2['focusable'] = !a0.isDisabled && a0.focusable;
|
|
object2['aria-disabled'] = a0.isDisabled;
|
|
object.inputProps = object2;
|
|
return object;
|
|
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();
|
|
}
|
|
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, 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() { // 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);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun55378, 6986, [57, 31, 4570, 2]) /* metro module 6986, dependencies: [57, 31, 4570, 2] */;
|