131 lines
7.6 KiB
TypeScript
131 lines
7.6 KiB
TypeScript
/* Metro module 9017; source: modules/phone/native/FormPhoneOrEmail.tsx; dependencies: [31, 27, 33, 4501, 697, 5278, 1244, 4573, 8993, 8968, 8969, 8970, 2] */
|
|
function _fun70160(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#70160, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9202:6, offset: 0x01cf0cf6, size: 385 bytes, params: 8, frame: 23
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = importAll(31) /* metro dependency 31 */;
|
|
const env0_4 = (require(27) /* metro dependency 27 */).View;
|
|
const value2 = require(33) /* metro dependency 33 */;
|
|
const env0_5 = value2.jsx;
|
|
const env0_6 = value2.jsxs;
|
|
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = createStylesModule.createStyles;
|
|
const INTERACTIVE_BACKGROUND_SELECTED = (importDefault(697) /* metro dependency 697: native */).colors.INTERACTIVE_BACKGROUND_SELECTED;
|
|
const env0_7 = Reflect.apply(createStyles, createStylesModule, [{label: {marginBottom: 8}, input: {'flexGrow': 1,
|
|
'marginBottom': 8}, error: {marginBottom: 8}, hint: {marginBottom: 8},
|
|
selectorOuterContainer: {overflow: 'hidden'}, selectorContainer: {'flex': 1, 'flexDirection': 'row'},
|
|
selectorPressable: {justifyContent: 'center'}, selectorText: {alignSelf: 'center'},
|
|
separator: {'borderLeftWidth': 1, 'borderLeftColor': null, 'marginHorizontal': 12, 'marginVertical': -4,
|
|
borderLeftColor: INTERACTIVE_BACKGROUND_SELECTED}}]);
|
|
value = value.forwardRef(_fun70162);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/phone/native/FormPhoneOrEmail.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function CountryCodeSelector({show, alpha2, countryCode, onPress}) { // fn#70161, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9202:575, offset: 0x01cf0e77, size: 383 bytes, params: 2, frame: 29
|
|
var r0;
|
|
var PressableOpacity;
|
|
var intl;
|
|
const styles = useStyles();
|
|
const value3 = '';
|
|
const value4 = value3 + (alpha2 ?? value3) + ' ' + countryCode;
|
|
if (show) {
|
|
var viewBindingProps = {style: styles.selectorOuterContainer};
|
|
var viewBinding2Props = {style: styles.selectorContainer};
|
|
PressableOpacity = (require(5278) /* metro dependency 5278: Pressables */).PressableOpacity;
|
|
var pressableOpacityProps = {onPress: onPress, style: styles.selectorPressable,
|
|
androidRippleConfig: {borderless: true}, accessibilityRole: 'button', accessibilityLabel: value4};
|
|
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
pressableOpacityProps.accessibilityHint = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.GwAW3k);
|
|
r0 = <View {...viewBindingProps}><View {...viewBinding2Props}><PressableOpacity {...pressableOpacityProps}>{((Text) => <Text style={styles.selectorText} variant="text-md/medium" color="mobile-text-heading-primary">{value4}</Text>)((require(4573) /* metro dependency 4573: Text */).Text)}</PressableOpacity><View style={styles.separator} /></View></View>;
|
|
} else {
|
|
r0 = null;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun70162(a0, a1) { // fn#70162, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9202:1158, offset: 0x01cf0ff6, size: 734 bytes, params: 3, frame: 32
|
|
var r7;
|
|
const style = a0.style;
|
|
const textInputStyle = a0.textInputStyle;
|
|
const label = a0.label;
|
|
const error = a0.error;
|
|
let value = a0.value;
|
|
const hint = a0.hint;
|
|
const env0_0 = a0.onChangeText;
|
|
const env0_1 = a0.alpha2;
|
|
const countryCode = a0.countryCode;
|
|
const env0_3 = a0.onPressCountrySelector;
|
|
const forceMode = a0.forceMode;
|
|
const object2 = {'style': 0, 'textInputStyle': 0, 'label': 0, 'error': 0, 'value': 0, 'hint': 0, 'onChangeText': 0,
|
|
'alpha2': 0, 'countryCode': 0, 'onPressCountrySelector': 0, 'forceMode': 0};
|
|
const value2 = null;
|
|
silentSetPrototypeOf(object2, value2, undefined);
|
|
const value3 = copyDataProperties({}, a0, object2, undefined);
|
|
const closure = handleChangeText;
|
|
const styles = useStyles();
|
|
const env0_5 = (require(8993) /* metro dependency 8993: PhoneOrEmailUtils */).shouldShowCountryCodeSelector(forceMode,
|
|
value);
|
|
const binding = env0_3;
|
|
const env0_7 = binding.useRef({handleChangeText: closure, value: value});
|
|
binding.useEffect(_fun70164);
|
|
binding.useEffect(_fun70165, [countryCode]);
|
|
const items2 = [value2 != label ? ((Component) => <Component style={styles.label}>{label}</Component>)(importDefault(8968) /* metro dependency 8968: FreeFormLabel */) : value2];
|
|
const FreeFormTextInput = importDefault(8969) /* metro dependency 8969: FreeFormTextInput */;
|
|
const defaultImport2Props = {...value3};
|
|
defaultImport2Props['renderLeadingComponent'] = renderLeadingComponent;
|
|
defaultImport2Props['error'] = value2 != error;
|
|
defaultImport2Props['ref'] = a1;
|
|
defaultImport2Props['value'] = value;
|
|
defaultImport2Props['style'] = [styles.input, textInputStyle];
|
|
defaultImport2Props['onChangeText'] = closure;
|
|
const PhoneOrEmailSelectorForceMode = (require(8993) /* metro dependency 8993: PhoneOrEmailUtils */).PhoneOrEmailSelectorForceMode;
|
|
let PHONE = PhoneOrEmailSelectorForceMode.PHONE;
|
|
defaultImport2Props['textContentType'] = forceMode !== PHONE ? 'emailAddress' : 'telephoneNumber';
|
|
PHONE = PhoneOrEmailSelectorForceMode.PHONE;
|
|
defaultImport2Props['keyboardType'] = forceMode !== PHONE ? 'email-address' : 'phone-pad';
|
|
defaultImport2Props['accessibilityLabel'] = label;
|
|
defaultImport2Props['accessibilityHint'] = hint;
|
|
items2[1] = <FreeFormTextInput {...defaultImport2Props} />;
|
|
if (value2 != error) {
|
|
value = importDefault(8970) /* metro dependency 8970: FreeFormErrorLabel */;
|
|
value = ((Component) => <Component style={styles.error}>{error}</Component>)(value);
|
|
r7 = value;
|
|
} else {
|
|
r7 = value2;
|
|
}
|
|
items2[2] = r7;
|
|
items2[3] = value2 != hint ? ((Text) => <Text style={styles.hint} variant="text-xs/medium" color="text-muted">{hint}</Text>)((require(4573) /* metro dependency 4573: Text */).Text) : value2;
|
|
return (
|
|
<View style={style}>
|
|
{items2}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function handleChangeText(a0) { // fn#70163, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9202:1363, offset: 0x01cf12d4, size: 80 bytes, params: 2, frame: 15
|
|
let value = environment.__proto__;
|
|
value = Reflect.apply((require(8993) /* metro dependency 8993: PhoneOrEmailUtils */).shouldShowCountryCodeSelector,
|
|
value, [forceMode, a0]);
|
|
if (onChangeText != null) {
|
|
onChangeText(a0, value ? countryCode : '');
|
|
}
|
|
}
|
|
|
|
function _fun70165() { // fn#70165, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9202:1579, offset: 0x01cf1339, size: 32 bytes, params: 1, frame: 11
|
|
const current = env0_7.current;
|
|
current.handleChangeText(current.value);
|
|
}
|
|
|
|
function renderLeadingComponent() { // fn#70166, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9202:1757, offset: 0x01cf1359, size: 61 bytes, params: 1, frame: 14
|
|
return (
|
|
<CountryCodeSelector
|
|
show={env0_5}
|
|
alpha2={alpha2}
|
|
countryCode={countryCode}
|
|
onPress={onPressCountrySelector}
|
|
/>
|
|
);
|
|
}
|
|
|