Closed marklawlor closed 11 months ago
The following warning is thrown:
```
The `redirect` prop on
Any updates here? This is the cause of the false positive warning
The `redirect` prop on <Screen /> is deprecated and will be removed. Please use `router.redirect` instead
that is bugging a lot of people on the latest Expo Router (2.0.8) and latest Expo SDK (49)
Motivation
Fix ENG-9886.
Execution
useDeprecated
is a hook I added a while ago to easily log deprecated warnings once, and handle edge cases such as preventing multiple warnings during SSR & CI environment. I added code comments to explain its parameters.The issue was the
guard
has a default value oftrue
. So if you passundefined
, instead of usingundefined
it will switch totrue
. This is counter intuitive and a sign this hook needs to be refactored.I like the guard having a truthy default, because you can simply write
useDeprecated(<message>)
with no guard. Maybe we need to split it into two functions?