📅  最后修改于: 2022-03-11 15:02:28.100000             🧑  作者: Mango
// React Router v6 (Native)
// Same as 'useLinkClickHandler' from 'react-router-dom'
// returns a press event handler for custom navigation.
import { TouchableHighlight } from 'react-native';
import { useLinkPressHandler } from 'react-router-native';
function Link({ onPress, replace = false, state, to, ...rest }) {
let handlePress = useLinkPressHandler(to, {
replace,
state,
});
return (
{
onPress?.(e);
!e.defaultPrevented && handlePress(e);
}}
/>
);
}