Skip to content

Commit

Permalink
close #152
Browse files Browse the repository at this point in the history
  • Loading branch information
nandorojo committed Sep 11, 2022
1 parent 3f69da7 commit ffc8890
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/params/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,14 @@ export function createParam<
const nextRouter = useRouter()
const nativeRoute = useRoute()
const nativeNavigation = useNavigation()
const nativeStateFromParams = (nativeRoute?.params as any)?.[
name
] as ParsedType

const [nativeStateFromReact, setNativeStateFromReact] = useState<
ParsedType | InitialValue
>(() => (nativeRoute?.params as any)?.[name] ?? (initial as InitialValue))
>(() => nativeStateFromParams ?? (initial as InitialValue))

const nativeStateFromParams = nativeRoute?.params as any as ParsedType
const setNativeStateFromParams = useCallback((value: ParsedType) => {
nativeNavigation?.setParams({
[name]: value,
Expand Down

0 comments on commit ffc8890

Please sign in to comment.