update to new geo hook
This commit is contained in:
@@ -8,9 +8,9 @@ import {
|
|||||||
INTERNATIONAL_TELEPHONE_CODES,
|
INTERNATIONAL_TELEPHONE_CODES,
|
||||||
} from '#/lib/international-telephone-codes'
|
} from '#/lib/international-telephone-codes'
|
||||||
import {isWeb} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
import {useGeolocationStatus} from '#/state/geolocation'
|
|
||||||
import {atoms as a, web} from '#/alf'
|
import {atoms as a, web} from '#/alf'
|
||||||
import * as Select from '#/components/Select'
|
import * as Select from '#/components/Select'
|
||||||
|
import {useGeolocation} from '#/geolocation'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Country picker for a phone number input
|
* Country picker for a phone number input
|
||||||
@@ -26,7 +26,7 @@ export function InternationalPhoneCodeSelect({
|
|||||||
onChange: (value: string) => void
|
onChange: (value: string) => void
|
||||||
}) {
|
}) {
|
||||||
const {_, i18n} = useLingui()
|
const {_, i18n} = useLingui()
|
||||||
const {location} = useGeolocationStatus()
|
const location = useGeolocation()
|
||||||
|
|
||||||
const defaultCountry = useMemo(() => {
|
const defaultCountry = useMemo(() => {
|
||||||
return getDefaultCountry(location)
|
return getDefaultCountry(location)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import React from 'react'
|
|||||||
import {type TextInput, View} from 'react-native'
|
import {type TextInput, View} from 'react-native'
|
||||||
|
|
||||||
import {getDefaultCountry} from '#/lib/international-telephone-codes'
|
import {getDefaultCountry} from '#/lib/international-telephone-codes'
|
||||||
import {useGeolocationStatus} from '#/state/geolocation'
|
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
import {DateField, LabelText} from '#/components/forms/DateField'
|
import {DateField, LabelText} from '#/components/forms/DateField'
|
||||||
@@ -13,6 +12,7 @@ import * as ToggleButton from '#/components/forms/ToggleButton'
|
|||||||
import {Globe_Stroke2_Corner0_Rounded as Globe} from '#/components/icons/Globe'
|
import {Globe_Stroke2_Corner0_Rounded as Globe} from '#/components/icons/Globe'
|
||||||
import {InternationalPhoneCodeSelect} from '#/components/InternationalPhoneCodeSelect'
|
import {InternationalPhoneCodeSelect} from '#/components/InternationalPhoneCodeSelect'
|
||||||
import {H1, H3} from '#/components/Typography'
|
import {H1, H3} from '#/components/Typography'
|
||||||
|
import {useGeolocation} from '#/geolocation'
|
||||||
|
|
||||||
export function Forms() {
|
export function Forms() {
|
||||||
const [toggleGroupAValues, setToggleGroupAValues] = React.useState(['a'])
|
const [toggleGroupAValues, setToggleGroupAValues] = React.useState(['a'])
|
||||||
@@ -26,7 +26,7 @@ export function Forms() {
|
|||||||
const [value, setValue] = React.useState('')
|
const [value, setValue] = React.useState('')
|
||||||
const [date, setDate] = React.useState('2001-01-01')
|
const [date, setDate] = React.useState('2001-01-01')
|
||||||
|
|
||||||
const {location} = useGeolocationStatus()
|
const location = useGeolocation()
|
||||||
const [telCode, setTelCode] = React.useState(() =>
|
const [telCode, setTelCode] = React.useState(() =>
|
||||||
getDefaultCountry(location),
|
getDefaultCountry(location),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user