diff --git a/templates/app/react-native/package.json b/templates/app/react-native/package.json index 09f9159570..14e799b900 100644 --- a/templates/app/react-native/package.json +++ b/templates/app/react-native/package.json @@ -24,7 +24,7 @@ "formik": "^2.1.2", "i18n-js": "^3.5.1", "lodash": "^4.17.15", - "native-base": "^2.13.8", + "native-base": "2.13.8", "prop-types": "^15.7.2", "react": "~16.9.0", "react-dom": "~16.9.0", diff --git a/templates/app/react-native/src/screens/CreateUpdateTenant/CreateUpdateTenantForm.js b/templates/app/react-native/src/screens/CreateUpdateTenant/CreateUpdateTenantForm.js index ff5801f914..0a1c05771b 100644 --- a/templates/app/react-native/src/screens/CreateUpdateTenant/CreateUpdateTenantForm.js +++ b/templates/app/react-native/src/screens/CreateUpdateTenant/CreateUpdateTenantForm.js @@ -1,8 +1,8 @@ import { Formik } from 'formik'; import i18n from 'i18n-js'; -import { Container, Content, Input, InputGroup, Label } from 'native-base'; +import { Container, Content, Input, InputGroup, Label, Item, Icon } from 'native-base'; import PropTypes from 'prop-types'; -import React, { useRef } from 'react'; +import React, { useRef, useState } from 'react'; import { StyleSheet } from 'react-native'; import * as Yup from 'yup'; import FormButtons from '../../components/FormButtons/FormButtons'; @@ -15,7 +15,10 @@ const validations = { function CreateUpdateTenantForm({ editingTenant = {}, submit, remove }) { const tenantNameRef = useRef(); + const adminEmailRef = useRef(); + const adminPasswordRef = useRef(); + const [showAdminPassword, setShowAdminPassword] = useState(false); const hasRemovePermission = usePermission('AbpTenantManagement.Tenants.Delete'); const onSubmit = values => { @@ -25,11 +28,25 @@ function CreateUpdateTenantForm({ editingTenant = {}, submit, remove }) { }); }; + const adminEmailAddressValidation = Yup.lazy(() => + Yup.string() + .required('AbpAccount::ThisFieldIsRequired.') + .email('AbpAccount::ThisFieldIsNotAValidEmailAddress.'), + ); + + const adminPasswordValidation = Yup.lazy(() => + Yup.string().required('AbpAccount::ThisFieldIsRequired.'), + ); + return ( + !editingTenant.id ? adminEmailRef.current._root.focus() : null + } + returnKeyType={!editingTenant.id ? 'next' : 'done'} onChangeText={handleChange('name')} onBlur={handleBlur('name')} value={values.name} /> {errors.name} + {!editingTenant || !editingTenant.id ? ( + <> + + + adminPasswordRef.current._root.focus()} + returnKeyType="next" + onChangeText={handleChange('adminEmailAddress')} + onBlur={handleBlur('adminEmailAddress')} + value={values.adminEmailAddress} + /> + + {errors.adminEmailAddress} + + + + + setShowAdminPassword(!showAdminPassword)} + /> + + + {errors.adminPassword} + + ) : null}