Move headerMode out of global shell state (#10527)

This commit is contained in:
Samuel Newman
2026-05-18 18:53:12 +01:00
committed by GitHub
parent e40c9bcf98
commit 0dc062294f
7 changed files with 106 additions and 90 deletions
-1
View File
@@ -14,7 +14,6 @@ export {
export {
useEnableMinimalShellMode,
useEnableMinimalShellModeForScreen,
useMinimalShellMode,
} from './minimal-mode'
export {useOnboardingDispatch, useOnboardingState} from './onboarding'
export {useTickEveryMinute} from './tick-every-minute'
+2 -10
View File
@@ -14,7 +14,6 @@ import {
import {useFocusEffect} from '@react-navigation/native'
type StateContext = {
headerMode: SharedValue<number>
footerMode: SharedValue<number>
}
type SetContext = {
@@ -28,24 +27,18 @@ const setContext = createContext<SetContext | null>(null)
setContext.displayName = 'MinimalModeSetContext'
export function Provider({children}: React.PropsWithChildren<{}>) {
const headerMode = useSharedValue(0)
const footerMode = useSharedValue(0)
const setModeWorklet = useCallback(
(v: boolean) => {
'worklet'
headerMode.set(() =>
withSpring(v ? 1 : 0, {
overshootClamping: true,
}),
)
footerMode.set(() =>
withSpring(v ? 1 : 0, {
overshootClamping: true,
}),
)
},
[headerMode, footerMode],
[footerMode],
)
// defaults to "visible", if the count is >0 it gets hidden
@@ -74,10 +67,9 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
const value = useMemo(
() => ({
headerMode,
footerMode,
}),
[headerMode, footerMode],
[footerMode],
)
return (
<stateContext.Provider value={value}>