UselinkPresshandler

// React Router v6 (Native)
// Same as 'useLinkClickHandler' from 'react-router-dom'
// returns a press event handler for custom <Link> 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 (
    <TouchableHighlight
      {...rest}
      onPress={e => {
        onPress?.(e);
        !e.defaultPrevented && handlePress(e);
      }}
    />
  );
}
Coffee Addict