146 lines
8.0 KiB
TypeScript
146 lines
8.0 KiB
TypeScript
/* Metro module 14330; source: modules/auth/native/components/RegisterUsernameInput.tsx; dependencies: [29, 57, 31, 14304, 33, 4501, 4017, 13282, 4572, 7684, 697, 4573, 1244, 14322, 7981, 477, 2] */
|
|
function _fun108464(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#108464, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14527:6, offset: 0x0232176a, size: 480 bytes, params: 8, frame: 22
|
|
var object2;
|
|
const env0_0 = require;
|
|
const env0_3 = ['username'];
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_4 = importDefault(29) /* metro dependency 29 */;
|
|
const env0_5 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_6 = importAll(31) /* metro dependency 31 */;
|
|
let value = require(14304) /* metro dependency 14304: RegistrationUIStore */;
|
|
const env0_7 = value.setRegistrationErrors;
|
|
const env0_8 = value.useRegistrationUIStore;
|
|
value = require(33) /* metro dependency 33 */;
|
|
const env0_9 = value.jsx;
|
|
const env0_10 = value.jsxs;
|
|
const env0_11 = value.Fragment;
|
|
const env0_12 = (require(4501) /* metro dependency 4501: createStyles */).createStyles({status: {width: '90%'},
|
|
inputHint: {width: '100%'}});
|
|
object2 = {};
|
|
const FadeIn = (require(4017) /* metro dependency 4017: ReanimatedRexport */).FadeIn;
|
|
object2.entering = FadeIn.duration(300);
|
|
const FadeOut = (require(4017) /* metro dependency 4017: ReanimatedRexport */).FadeOut;
|
|
object2.exiting = FadeOut.duration(300);
|
|
object2 = {};
|
|
const LinearTransition = (require(4017) /* metro dependency 4017: ReanimatedRexport */).LinearTransition;
|
|
const easing = LinearTransition.easing;
|
|
const Easing = (require(4017) /* metro dependency 4017: ReanimatedRexport */).Easing;
|
|
const inOut = Easing.inOut;
|
|
const Easing2 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).Easing;
|
|
object2.layout = Reflect.apply(easing, LinearTransition, [Reflect.apply(inOut, Easing,
|
|
[Easing2.quad])]).duration(300);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/auth/native/components/RegisterUsernameInput.tsx');
|
|
exports.RegisterUsernameInput = RegisterUsernameInput;
|
|
}
|
|
|
|
function UsernameStatusMessage_108465({usernameStatus, isUsernameFocused}) { // fn#108465, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14527:522, offset: 0x0232194a, size: 708 bytes, params: 2, frame: 24
|
|
var r0;
|
|
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
var Stack;
|
|
var items2;
|
|
var value;
|
|
const styles = useStyles();
|
|
const type = usernameStatus?.type;
|
|
const NameValidationState = (require(13282) /* metro dependency 13282: UniqueUsernamesTypes */).NameValidationState;
|
|
const ERROR = NameValidationState.ERROR;
|
|
if (type === ERROR) {
|
|
Stack = (require(4572) /* metro dependency 4572: StackNative */).Stack;
|
|
items2 = [((CircleErrorIcon) => <CircleErrorIcon size="xs" color={(importDefault(697) /* metro dependency 697: native */).colors.TEXT_FEEDBACK_CRITICAL} />)((require(7684) /* metro dependency 7684: CircleErrorIcon */).CircleErrorIcon)];
|
|
items2[1] = <Text variant="text-xs/medium" color="text-feedback-critical" style={styles.status} {...env0_13} {...env0_14} {...{['animated']: true}}>{usernameStatus.message}</Text>;
|
|
r0 = <Stack direction="horizontal" spacing={4} align="flex-start">{items2}</Stack>;
|
|
} else if (isUsernameFocused) {
|
|
if (usernameStatus?.type === (require(13282) /* metro dependency 13282: UniqueUsernamesTypes */).NameValidationState.AVAILABLE) {
|
|
var textProps = {...env0_13, ...env0_14};
|
|
textProps['style'] = styles.status;
|
|
textProps['variant'] = 'text-xs/medium';
|
|
textProps['animated'] = true;
|
|
value = <Text variant="text-xs/medium" color="text-feedback-positive">{usernameStatus.message}</Text>;
|
|
value = <Text {...textProps}>{value}</Text>;
|
|
r0 = value;
|
|
} else if (isUsernameFocused) {
|
|
var textProps = {...env0_13, ...env0_14};
|
|
textProps['style'] = styles.inputHint;
|
|
textProps['variant'] = 'text-xs/medium';
|
|
textProps['color'] = 'text-muted';
|
|
textProps['animated'] = true;
|
|
value = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.y7LSyU);
|
|
value = <Text {...textProps}>{value}</Text>;
|
|
r0 = value;
|
|
} else {
|
|
r0 = null;
|
|
}
|
|
} else if (isUsernameFocused) {
|
|
var textProps = {...env0_13, ...env0_14};
|
|
textProps['style'] = styles.inputHint;
|
|
textProps['variant'] = 'text-xs/medium';
|
|
textProps['color'] = 'text-muted';
|
|
textProps['animated'] = true;
|
|
value = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.y7LSyU);
|
|
value = <Text {...textProps}>{value}</Text>;
|
|
r0 = value;
|
|
} else {
|
|
r0 = null;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function RegisterUsernameInput({username, setUsername, usernameStatus, onSubmitEditing, submitBehavior, autoFocus}) { // fn#108466, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14527:1464, offset: 0x02321c0e, size: 669 bytes, params: 2, frame: 33
|
|
let binding = env0_6;
|
|
const value3 = binding.useRef(null);
|
|
(importDefault(14322) /* metro dependency 14322: useFocusRefOnNavigation */)({inputRef: value3,
|
|
enabled: autoFocus != null && autoFocus});
|
|
binding = env0_6;
|
|
const [property, property2] = env0_5(binding.useState(true), 2);
|
|
const value8 = binding.useCallback(_fun108468, [useRegistrationUIStore(function(a0) {
|
|
return a0.errors;
|
|
}), setUsername]);
|
|
const value9 = binding.useCallback(_fun108469, [property2]);
|
|
const value10 = binding.useCallback(_fun108470, [property2]);
|
|
const jsxRuntimeEnv0_11Binding = jsxRuntimeEnv0_11;
|
|
const TextInput = (require(7981) /* metro dependency 7981: TextInputNative */).TextInput;
|
|
const object = {ref: value3};
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const string = intl.string;
|
|
const IEpCBQ = (require(1244) /* metro dependency 1244: indexNative */).t.IEpCBQ;
|
|
object.label = Reflect.apply(string, intl, [IEpCBQ]);
|
|
object.accessibilityHint = intl.string((require(1244) /* metro dependency 1244: indexNative */).t['47dcUZ']);
|
|
object.onChange = value8;
|
|
object.autoCorrect = false;
|
|
object.secureTextEntry = (require(477) /* metro dependency 477: PlatformUtils */).isAndroid();
|
|
object.keyboardType = (require(477) /* metro dependency 477: PlatformUtils */).isAndroid() ? 'visible-password' : 'default';
|
|
object.value = username;
|
|
object.onSubmitEditing = onSubmitEditing;
|
|
object.returnKeyType = 'next';
|
|
object.autoComplete = 'username';
|
|
object.textContentType = 'username';
|
|
object.autoCapitalize = 'none';
|
|
object.onFocus = value9;
|
|
object.onBlur = value10;
|
|
object.isClearable = true;
|
|
const type = usernameStatus?.type;
|
|
const NameValidationState = (require(13282) /* metro dependency 13282: UniqueUsernamesTypes */).NameValidationState;
|
|
const ERROR = NameValidationState.ERROR;
|
|
object.status = type !== ERROR ? undefined : 'error';
|
|
object.submitBehavior = submitBehavior;
|
|
return (
|
|
<>
|
|
<TextInput {...object} />
|
|
<UsernameStatusMessage_108465 usernameStatus={usernameStatus} isUsernameFocused={property} />
|
|
</>
|
|
);
|
|
}
|
|
|
|
function _fun108468(a0) { // fn#108468, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14527:1730, offset: 0x02321eab, size: 87 bytes, params: 2, frame: 16
|
|
var value2;
|
|
const username = env0_2.username;
|
|
if (username != null) {
|
|
env0_2.username;
|
|
value2 = environment.__proto__;
|
|
setRegistrationErrors(env1_4(env0_2, env1_3));
|
|
}
|
|
setUsername(a0.toLowerCase());
|
|
}
|
|
|