nandorojo / solito

🧍‍♂️ React Native + Next.js, unified.
https://solito.dev
MIT License
3.35k stars 169 forks source link

`useUpdateSearchParams` does not work with the react native app #468

Open wongk opened 2 months ago

wongk commented 2 months ago

Is there an existing issue for this?

Do you want this issue prioritized?

Current Behavior

I am using the useUpdateSearchParams API to set a query parameter on the route. It is working fine on web.

const updateParams = useUpdateSearchParams()
updateParams({ threadId: item.id }, { webBehavior: "replace" })

This does not work on mobile. The following log statement is always empty:

const params = useSearchParams()
useEffect(() => {
    console.info(`Params: ${params?.toString()}`)
}, [params])

Expected Behavior

No response

Steps To Reproduce

No response

Versions

- Solito: 4.2.2
- Next.js: 13.5.6
- Expo: 50.0.14
- React Native: 0.73.6

Screenshots

No response

Reproduction

No response

wongk commented 2 months ago

As a workaround, manually setting the query param works fine for my use case: router.replace(``/chat?threadId=${item.id}``)