Hooks
Open drawer handler
const { drawerRef } = userDrawer()
const openDrawer = () => {
return drawerRef.current?.openDrawer()
}
Close drawer handler
const { drawerRef } = userDrawer()
const closeDrawer = () => {
return drawerRef.current?.closeDrawer()
}
Params
const params = useParams()
const Home = (props: ScreenProps) => {
const params = props?.params;
console.log(params)
const router = useRouter()
return (
<View>
<Text>
Home
</Text>
<Link href="/settings/435345?search=5435&query=45435&done=true#done" >
Settings
</Link>
<Button
title='Settings'
onPress={() => {
router.push('/settings/435345?search=5435&query=45435&done=true#done')
}}
/>
</View>
)
}
{
blogID: 53455,
title: "Title"
}
Property | Details |
---|---|
key | Keys of type string . |
values | Values of type string or number . |
Router properties
const router = useRouter()
console.log(router)
navigate a link
const Home = (props: ScreenProps) => {
const params = props?.params
const router = useRouter()
return (
<View>
<Text>
Home
</Text>
<Link href="/settings/435345?search=5435&query=45435&done=true#done" >
Settings
</Link>
<Button
title='Settings'
onPress={() => {
router.push('/settings/435345?search=5435&query=45435&done=true#done')
}}
/>
</View>
)
}
Searchparams
const router = useRouter()
const searchparams = router?.query
with query: https://example.com/path?name=Branch&product=5345
Property | Details |
---|---|
key | Keys of type string . |
values | Values of type string or number . |
Note: Avoid using slashes at the end of link/url
Bad/not working: /settings/435345/?search=5435&query=45435&done=true#done
Use: /settings/435345?search=5435&query=45435&done=true#done
Property | Description |
---|---|
path | A string or null representing the path. |
basePath | A string representing the base path. |
hash | A string or null representing the hash. |
protocol | A string or null representing the protocol. |
asPath | A string representing the asPath. |
origin | A string or null representing the origin. |
username | A string or null representing the username. |
password | A string or null representing the password. |
hostname | A string or null representing the hostname. |
port | A string or null representing the port. |
query | An object with keys as strings and values of any type. |
push | A function for navigating with options, returning a promise. |
history | An object with methods for navigating history and retrieving history stack. |
title | Current screen title |
Navigation Provider
const navigation = useNavigation();
Navigation properties:
Property | Details |
---|---|
loadingComponent | Indicates whether a loading component is displayed. |
setLoadingComponent | Function to set the loading component state. |
customDynamicNavbar | Custom dynamic navigation bar component. |
setCustomDynamicNavbar | Function to set the custom dynamic navbar component. |