How to use the @react-navigation/core.useNavigation function in @react-navigation/core

To help you get started, we’ve selected a few @react-navigation/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github berty / berty / js / packages / components / chat / shared-components / Message.tsx View on Github external
}> = ({ id, convKind, members, previousMessageId, nextMessageId, convPK }) => {
	const ctx = useMsgrContext()
	const inte = useInteraction(id, convPK)
	const previousMessage = useInteraction(previousMessageId, convPK)
	const nextMessage = useInteraction(nextMessageId, convPK)
	const client: any = useClient()
	const navigation = useNativeNavigation()
	const _styles = useStylesMessage()
	const [{ row, margin, padding, column, text, border, color, flex }, { scaleSize }] = useStyles()
	const lastInte = useLastConvInteraction(convPK, interactionsFilter)
	if (!inte) {
		return null
	}
	let monitorPayload
	if (inte.type === messengerpb.AppMessage.Type.TypeMonitorMetadata) {
		/* typespb.MonitorGroup.TypeEventMonitor */
		const monitorEvent = inte.payload.event
		switch (monitorEvent.type) {
			case eventMonitorTypes.TypeEventMonitorAdvertiseGroup:
				const msgAdvertise = `local peer advertised ${monitorEvent.advertiseGroup.peerId.substr(
					monitorEvent.advertiseGroup.peerId.length - 10,
				)} on ${monitorEvent.advertiseGroup.driverName}, with ${
					monitorEvent.advertiseGroup.maddrs.length
github react-navigation / navigation-ex / packages / native / src / useScrollToTop.tsx View on Github external
export default function useScrollToTop(
  ref: React.RefObject
) {
  const navigation = useNavigation();
  const route = useRoute();

  React.useEffect(() => {
    let current = navigation;

    // The screen might be inside another navigator such as stack nested in tabs
    // We need to find the closest tab navigator and add the listener there
    while (current && current.dangerouslyGetState().type !== 'tab') {
      current = current.dangerouslyGetParent();
    }

    if (!current) {
      return;
    }

    const unsubscribe = current.addListener(
github berty / berty / js / packages / components / chat / message / UserMessageComponents.tsx View on Github external
}> = ({ inte, msgBorderColor, isFollowedMessage, msgBackgroundColor, msgTextColor }) => {
	const {
		payload: { body: message },
	} = inte

	const client = useClient()
	const navigation = useNativeNavigation()
	const [{ margin, padding, column, border }, { scaleSize }] = useStyles()
	const [isReadMore, setReadMore] = useState(false)

	useEffect(() => {
		message && setReadMore(message.length > READ_MORE_MESSAGE_LENGTH)
	}, [message])

	return (
github berty / berty / js / packages / components / modals / DeleteAccount.tsx View on Github external
const DeleteAccountContent: React.FC<{}> = () => {
	const { deleteAccount } = useMsgrContext()
	const _styles = useStylesDeleteAccount()
	const [{ row, margin, background, border, color, padding, text, column }] = useStyles()
	const navigation = useReactNavigation()
	const [deleteConfirmation, setDeleteConfirmation] = useState()
	const confirmed = deleteConfirmation === DELETE_STR

	return (
		
			{(t: any): React.ReactNode => (
				<>