decord/source/design/components/Input/native/NativeTextInput.native.tsx

142 lines
4.6 KiB
TypeScript
Raw Normal View History

// Module ID: 6624
// Function ID: 6625
2026-07-20 16:05:17 +00:00
// Name: useKeyboardBlurring
// Dependencies: [19, 17, 1479, 1074, 21, 6625, 4992, 4962, 6626, 4271, 4264, 2]
2026-07-29 08:29:29 +00:00
// Exports: useKeyboardBlurring
2026-07-20 16:05:17 +00:00
// Module 6624 (useKeyboardBlurring)
2026-08-24 06:08:38 +00:00
import importAllResult from "noop" /* 19 */;
import get_ActivityIndicator from "get ActivityIndicator" /* 17 */;
import closure_8 from "subscribeToKeyboardUIStore" /* 1479 */;
import { KeyboardThemes } from "ME" /* 1074 */;
2026-08-24 06:08:38 +00:00
import jsxProd from "jsxProd" /* 21 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
let c3 = importAllResult;
({ Pressable: c4, TextInput: c5, StyleSheet: closure_6, View: error } = get_ActivityIndicator);
({ jsx: c10, jsxs: unpackModuleId } = jsxProd);
const forwardRefResult = importAllResult.forwardRef((value, closure_1) => {
2026-07-29 08:29:29 +00:00
const ref = importAllResult.useRef(null);
2026-07-20 16:05:17 +00:00
const items = [ref];
const effect = importAllResult.useEffect(() => {
2026-07-29 08:29:29 +00:00
const keyboardIsOpen = ref(defaultValue[5]).getKeyboardIsOpen();
2026-08-24 06:08:38 +00:00
return closure_1_8((systemKeyboardOpen) => {
2026-07-20 16:05:17 +00:00
systemKeyboardOpen = systemKeyboardOpen.systemKeyboardOpen;
if (!tmp) {
const current = ref.current;
2026-07-29 08:29:29 +00:00
if (current != null) {
2026-07-20 16:05:17 +00:00
current.blur();
}
}
});
}, items);
2026-07-29 08:29:29 +00:00
let isScreenReaderEnabled;
let defaultValue;
value = value.value;
isScreenReaderEnabled = value;
defaultValue = value.defaultValue;
const items1 = [ref, value, defaultValue];
const effect1 = importAllResult.useEffect(() => {
const current = ref.current;
if (current != null) {
let tmp = isScreenReaderEnabled;
if (isScreenReaderEnabled == null) {
tmp = defaultValue;
}
const obj = { text: null };
obj[0] = tmp;
current.setNativeProps(obj);
}
}, items1);
let obj = ref(defaultValue[6]);
const mountLayoutEffect = obj.useMountLayoutEffect(() => {
const current = ref.current;
if (current != null) {
const obj = { text: null };
obj[0] = isScreenReaderEnabled;
current.setNativeProps(obj);
}
});
isScreenReaderEnabled = undefined;
2026-08-24 06:08:38 +00:00
obj1 = ref(defaultValue[7]);
2026-07-29 08:29:29 +00:00
isScreenReaderEnabled = obj1.useIsScreenReaderEnabled();
const items2 = [ref];
const items3 = [isScreenReaderEnabled];
const callback = importAllResult.useCallback(() => {
const current = ref.current;
let focusResult;
if (current != null) {
focusResult = current.focus();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return focusResult;
}, items2);
const memo = importAllResult.useMemo(() => {
const obj = {};
2026-08-24 06:08:38 +00:00
const merged = Object.assign(closure_1_6.absoluteFillObject);
2026-07-29 08:29:29 +00:00
let str = "flex";
if (isScreenReaderEnabled) {
str = "none";
}
obj.display = str;
return obj;
}, items3);
ref(defaultValue[9]);
if (null != value.keyboardAppearance) {
obj = {};
obj = { value: "hash", defaultValue: "call" };
2026-07-29 08:29:29 +00:00
let tmp6Result = tmp6(tmp3[10]);
let merged = Object.assign(tmp6Result.mergeProps(value, tmp4, obj));
tmp6Result = tmp6(tmp3[10]);
obj.ref = tmp6Result.mergeRefs(ref, closure_1);
2026-07-29 08:29:29 +00:00
const tmp19 = callback(closure_5, obj);
let tmp21Result = tmp19;
if (!value.multiline) {
obj1 = { style: null, children: null };
obj1[0] = { flexBasis: 0, flexGrow: 1 };
const items4 = [tmp19, ];
let current = ref.current;
let isFocusedResult;
if (current != null) {
isFocusedResult = current.isFocused();
}
let str = "auto";
if (isFocusedResult) {
str = "none";
}
const obj2 = { pointerEvents: null, onPress: null, style: null };
obj2[0] = str;
obj2[1] = callback;
obj2[2] = memo;
items4[1] = callback(closure_4, obj2);
obj1[1] = items4;
tmp21Result = closure_11(closure_7, obj1);
const tmp21 = closure_11;
const tmp22 = closure_7;
const tmp23 = closure_4;
}
return tmp21Result;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
value.keyboardAppearance = tmp6(tmp3[10]).isThemeDark(tmp12) ? KeyboardThemes.DARK : KeyboardThemes.LIGHT;
const tmp6Result1 = tmp6(tmp3[10]);
2026-07-20 16:05:17 +00:00
}
});
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("design/components/Input/native/NativeTextInput.native.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const useKeyboardBlurring = function useKeyboardBlurring(ref) {
2026-08-24 06:08:38 +00:00
closure_0 = ref;
2026-07-29 08:29:29 +00:00
const items = [ref];
const effect = importAllResult.useEffect(() => {
const keyboardIsOpen = ref(defaultValue[5]).getKeyboardIsOpen();
2026-08-24 06:08:38 +00:00
return closure_1_8((systemKeyboardOpen) => {
2026-07-29 08:29:29 +00:00
systemKeyboardOpen = systemKeyboardOpen.systemKeyboardOpen;
if (!tmp) {
const current = ref.current;
if (current != null) {
current.blur();
}
}
});
}, items);
};
2026-07-20 16:05:17 +00:00
export const NativeTextInput = forwardRefResult;