"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[274],{2190:(t,e,a)=>{a.r(e),a.d(e,{assets:()=>d,contentTitle:()=>r,default:()=>g,frontMatter:()=>n,metadata:()=>s,toc:()=>l});var o=a(4321),i=(a(2983),a(4993));const n={},r="Migrating from v2.1 to v2.2",s={unversionedId:"Migrations/migrate-to-v2.2",id:"Migrations/migrate-to-v2.2",title:"Migrating from v2.1 to v2.2",description:"Validation logic has been changed since v2.2.",source:"@site/docs/05-Migrations/03-migrate-to-v2.2.md",sourceDirName:"05-Migrations",slug:"/Migrations/migrate-to-v2.2",permalink:"/docs/Migrations/migrate-to-v2.2",draft:!1,editUrl:"https://github.com/goveo/react-international-phone/tree/master/packages/docs/docs/05-Migrations/03-migrate-to-v2.2.md",tags:[],version:"current",sidebarPosition:3,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Migrating from v2 to v3",permalink:"/docs/Migrations/migrate-to-v3"},next:{title:"Migrating from v1 to v2",permalink:"/docs/Migrations/migrate-to-v2"}},d={},l=[],c={toc:l};function g(t){let{components:e,...a}=t;return(0,i.kt)("wrapper",(0,o.Z)({},c,a,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"migrating-from-v21-to-v22"},"Migrating from v2.1 to v2.2"),(0,i.kt)("p",null,"Validation logic has been changed since v2.2.\n",(0,i.kt)("inlineCode",{parentName:"p"},"areaCodeMatch")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"formatMatch")," have now become additional return properties and are not required to mark the phone as valid."),(0,i.kt)("p",null,"You can additionally check ",(0,i.kt)("inlineCode",{parentName:"p"},"areaCodeMatch")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"formatMatch")," to revert validation logic to how it was working before v2.2 release:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},"const phoneValidation = usePhoneValidation('+1 (123) 456-7890');\nconst isPhoneValid =\n  phoneValidation.isValid &&\n  phoneValidation.areaCodeMatch &&\n  phoneValidation.formatMatch;\n")),(0,i.kt)("p",null,"Check the ",(0,i.kt)("a",{parentName:"p",href:"/docs/Usage/PhoneValidation"},"Phone Validation page")," to get more info about new validation behavior."))}g.isMDXComponent=!0}}]);