I am using this in my navigation stack:
<NavigationStack.Screen name="UserMenu" component={UserMenu} options={{ headerShown: false, cardStyleInterpolator: forSlideFromLeft, }} />
const forSlideFromLeft = (props) => { const { current, layouts } = props; console.log('PROPS FROM USER MENU', current) console.log('PROPS FROM USER MENU2', layouts) const translateX = current.progress.interpolate({ inputRange: [0, 1], outputRange: [-layouts.screen.width, 0], }); if (props.index === 2) { return { cardStyle: { transform: [{ translateX }], }, }; } else { return {}; }};
but I get an error on props
that Parameter 'props' implicitly has an 'any' type.
What could be it's type. If I infer from usage
in VS Code, I get this:
(props: { index?: any; current?: any; layouts?: any; })
But I don't want to use any
types. If I print the current
and layout
values on the console, I get something like this:
current:
{progress: AnimatedInterpolation}progress: AnimatedInterpolation {_listeners: {…}, _children: Array(0), _parent: AnimatedValue, _config: {…}, _interpolation: ƒ, …}__proto__: Object
layout:
{screen: {…}}screen: {width: 411.4285583496094, height: 707.4285888671875}__proto__: Object
How can I fix this? What would be the suitable type to use here?