Skip to content

Commit

Permalink
feat: onEndEditing to return a single object with all values
Browse files Browse the repository at this point in the history
  • Loading branch information
fakeheal committed Mar 1, 2022
1 parent 6191efb commit ee188f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions example/App.js
Expand Up @@ -24,7 +24,7 @@ export default function App() {
const [filled, setFilled] = useState(DEFAULT_STATE);

const onEndEditingMinimal = useCallback(
(isValid, countryCode, value, formatted, flag) => {
({isValid, countryCode, value, formatted, flag}) => {
console.log(
'onEndEditingMinimal',
isValid,
Expand All @@ -40,7 +40,7 @@ export default function App() {
);

const onEndEditingDefaultCountry = useCallback(
(isValid, countryCode, value, formatted, flag) => {
({isValid, countryCode, value, formatted, flag}) => {
console.log(
'onEndEditingDefaultCountry',
isValid,
Expand All @@ -55,7 +55,7 @@ export default function App() {
);

const onEndEditingFilled = useCallback(
(isValid, countryCode, value, formatted, flag) => {
({isValid, countryCode, value, formatted, flag}) => {
console.log(
'onEndEditingFilled',
isValid,
Expand Down
4 changes: 2 additions & 2 deletions src/index.tsx
Expand Up @@ -5,7 +5,7 @@ import { getEmojiFlag } from 'countries-list';

const INTL_SYMBOL = '+';

type IntlPhoneFieldProps = {
export type IntlPhoneFieldProps = {
flagUndetermined: string;
placeholder: string;
defaultCountry?: CountryCode;
Expand Down Expand Up @@ -120,7 +120,7 @@ export default function IntlPhoneField({
keyboardType="phone-pad"
onEndEditing={() => {
if (onEndEditing) {
onEndEditing(isValid, countryCode, value, formatted, flag);
onEndEditing({ isValid, countryCode, value, formatted, flag });
}
}}
{...textInputProps}
Expand Down

0 comments on commit ee188f1

Please sign in to comment.