Reanimated buttons above sheet in expo-router #489
-
|
I'd like to use
but the values of the useReanimatedTrueSheet-hook don't change. Am I missing something? Or do I need to create my own provider for the shared value (tested and it works)? // _layout.tsx
import {
createTrueSheetNavigator,
type TrueSheetNavigationEventMap,
type TrueSheetNavigationOptions,
type TrueSheetNavigationState,
} from '@lodev09/react-native-true-sheet/navigation'
import { ReanimatedTrueSheetProvider } from '@lodev09/react-native-true-sheet/reanimated'
import type { ParamListBase } from '@react-navigation/native'
import { withLayoutContext } from 'expo-router'
const { Navigator } = createTrueSheetNavigator()
const Sheet = withLayoutContext<TrueSheetNavigationOptions, typeof Navigator, TrueSheetNavigationState<ParamListBase>, TrueSheetNavigationEventMap>(Navigator)
export default function IndexLayout() {
return (
<ReanimatedTrueSheetProvider>
<Sheet>
<Sheet.Screen
name="index"
options={{
reanimated: true,
positionChangeHandler: (payload) => {
'worklet'
console.log(payload.position) // this one works ✅
},
dismissible: false,
detents: [0.12, 0.4, 0.9],
}}
/>
<Sheet.Screen
name="details"
options={{
reanimated: true,
positionChangeHandler: (payload) => {
'worklet'
console.log(payload.index) // ✅ also works and can also be shared via a provider
},
detents: ['auto', 1],
cornerRadius: 16,
}}
/>
</Sheet>
</ReanimatedTrueSheetProvider>
)
}// inside a component that's inside details-screen
const { animatedPosition, animatedIndex } = useReanimatedTrueSheet() // ❌ values never change |
Beta Was this translation helpful? Give feedback.
Answered by
lodev09
Jan 31, 2026
Replies: 1 comment
-
|
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lodev09
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
useReanimatedTrueSheetonly works with theReanimatedTrueSheetcomponent. You'll have to create your own provider when integrating with true sheet navigator