var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CreateAccount=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _TextInput=require("../components/TextInput");var _Instruction=require("../components/Instruction");var _reactNativeKeyboardAwareScrollView=require("react-native-keyboard-aware-scroll-view");var _reactNativePaper=require("react-native-paper");var _reactAuthShared=require("@brightlayer-ui/react-auth-shared");var _jsxFileName="/home/circleci/login-workflow/login-workflow/src/subScreens/CreateAccount.tsx";var makeContainerStyles=function makeContainerStyles(theme){return _reactNative.StyleSheet.create({safeContainer:{height:'100%',backgroundColor:theme.colors.surface,width:'100%',flexDirection:'row',justifyContent:'center'},scrollContainer:{flex:1,alignContent:'center'},scrollContentContainer:{alignSelf:'center',maxWidth:600},mainContainer:{flex:1,marginTop:8,paddingBottom:16},containerMargins:{marginHorizontal:16},bottomButtonContainer:{position:'absolute',bottom:16,width:'100%'}});};var makeStyles=function makeStyles(){return _reactNative.StyleSheet.create({inputMargin:{marginTop:24}});};var CreateAccount=function CreateAccount(props){var _props$initialEmail;var theme=(0,_reactNativePaper.useTheme)(props.theme);var _React$useState=_react.default.useState((_props$initialEmail=props.initialEmail)!==null&&_props$initialEmail!==void 0?_props$initialEmail:''),_React$useState2=(0,_slicedToArray2.default)(_React$useState,2),emailInput=_React$useState2[0],setEmailInput=_React$useState2[1];var _React$useState3=_react.default.useState(false),_React$useState4=(0,_slicedToArray2.default)(_React$useState3,2),hasEmailFormatError=_React$useState4[0],setHasEmailFormatError=_React$useState4[1];var _useLanguageLocale=(0,_reactAuthShared.useLanguageLocale)(),t=_useLanguageLocale.t;var containerStyles=makeContainerStyles(theme);var styles=makeStyles();return _react.default.createElement(_reactNative.SafeAreaView,{style:containerStyles.safeContainer,__source:{fileName:_jsxFileName,lineNumber:97,columnNumber:9}},_react.default.createElement(_reactNativeKeyboardAwareScrollView.KeyboardAwareScrollView,{style:containerStyles.scrollContainer,contentContainerStyle:containerStyles.scrollContentContainer,__source:{fileName:_jsxFileName,lineNumber:98,columnNumber:13}},_react.default.createElement(_Instruction.Instruction,{style:containerStyles.containerMargins,text:t('blui:SELF_REGISTRATION.INSTRUCTIONS'),__source:{fileName:_jsxFileName,lineNumber:102,columnNumber:17}}),_react.default.createElement(_reactNative.View,{style:[containerStyles.containerMargins,containerStyles.mainContainer],__source:{fileName:_jsxFileName,lineNumber:104,columnNumber:17}},_react.default.createElement(_TextInput.TextInput,{label:t('blui:LABELS.EMAIL'),value:emailInput,style:styles.inputMargin,keyboardType:'email-address',autoCapitalize:'none',error:hasEmailFormatError,errorText:hasEmailFormatError?t('blui:MESSAGES.EMAIL_ENTRY_ERROR'):'',onChangeText:function onChangeText(text){setEmailInput(text);setHasEmailFormatError(false);var validEmailOrEmpty=_reactAuthShared.EMAIL_REGEX.test(text)?text:'';props.onEmailChanged(validEmailOrEmpty);},onBlur:function onBlur(){if(emailInput.length>0&&!_reactAuthShared.EMAIL_REGEX.test(emailInput))setHasEmailFormatError(true);},onSubmitEditing:emailInput.length>0&&_reactAuthShared.EMAIL_REGEX.test(emailInput)?props.onSubmit:undefined,__source:{fileName:_jsxFileName,lineNumber:105,columnNumber:21}}))));};exports.CreateAccount=CreateAccount;
//# sourceMappingURL=CreateAccount.js.map