Skip to content

Commit 436caae

Browse files
fix: form crashing when no default country given (#282)
1 parent 198d476 commit 436caae

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/Fields/Input/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ import React from 'react'
77
const Input = React.forwardRef(({ ...props }, ref) => {
88
const { 'data-haserrors': haserrors } = props
99
return (
10-
<InputUI ref={ref} {...props} className={haserrors ? 'error-input' : ''} />
10+
<InputUI
11+
ref={ref}
12+
sx={{ fontFamily: 'inherit' }}
13+
{...props}
14+
className={haserrors ? 'error-input' : ''}
15+
/>
1116
)
1217
})
1318

src/Questions/Phone/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ const QuestionPhone = ({ isMobile, isoCode, question, useForm, ...props }) => {
1515
} = useForm
1616

1717
const getDefaultCountry = () => {
18-
if (question.defaultCountry && question.defaultCountry !== '')
18+
if (
19+
question?.defaultCountry &&
20+
typeof question.defaultCountry === 'string'
21+
) {
1922
return question.defaultCountry.toUpperCase()
20-
23+
}
2124
if (isoCode) return isoCode.toUpperCase()
2225

2326
return ''

0 commit comments

Comments
 (0)