Skip to content

useNavigationFocusEffect

Run effects when a screen gains or loses focus in React Navigation.

useNavigationFocusEffect

ts
import { useNavigationFocusEffect } from '@zyno-io/mobile-foundation-rn';

useNavigationFocusEffect(() => {
    loadScreenData();
}, []);

Fires when the screen comes into focus (navigated to or returned to via back).

useNavigationUnfocusEffect

ts
import { useNavigationUnfocusEffect } from '@zyno-io/mobile-foundation-rn';

useNavigationUnfocusEffect(() => {
    pauseVideo();
}, []);

Fires when the screen loses focus (navigated away from).

Parameters

ParamTypeDescription
callback() => voidEffect to run
depsany[]Dependency array