Added phone validation + new phone input box IO-414

This commit is contained in:
Patrick Fic
2020-12-08 10:11:41 -08:00
parent c4e0804130
commit 4ae344f33e
10 changed files with 105 additions and 35 deletions

View File

@@ -5,7 +5,9 @@ import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { openChatByPhone } from "../../redux/messaging/messaging.actions";
import PhoneFormItem from "../form-items-formatted/phone-form-item.component";
import PhoneFormItem, {
PhoneItemFormatterValidation,
} from "../form-items-formatted/phone-form-item.component";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
@@ -26,7 +28,14 @@ export function ChatNewConversation({ openChatByPhone }) {
const popContent = (
<div>
<Form form={form} onFinish={handleFinish}>
<Form.Item label={t("messaging.labels.phonenumber")} name="phoneNumber">
<Form.Item
label={t("messaging.labels.phonenumber")}
name="phoneNumber"
rules={[
({ getFieldValue }) =>
PhoneItemFormatterValidation(getFieldValue, "phoneNumber"),
]}
>
<PhoneFormItem />
</Form.Item>
<Button type="primary" htmlType="submit">