I have 2 tabs and would like to default it to the second scene/tab.
However, the library is rendering the first scene/tab.
import * as React from "react";
import { Text, View, useWindowDimensions } from "react-native";
import { TabView } from "reanimated-tab-view";
const FirstRoute = () => (
<View style={{ flex: 1, backgroundColor: "#ff4081" }}>
<Text>First</Text>
</View>
);
const SecondRoute = () => (
<View style={{ flex: 1, backgroundColor: "#673ab7" }}>
<Text>Second</Text>
</View>
);
const renderScene = ({ route }: { route: any }) => {
switch (route.key) {
case "first":
return <FirstRoute />;
case "second":
return <SecondRoute />;
default:
return null;
}
};
export function Tabs() {
const layout = useWindowDimensions();
const [index, setIndex] = React.useState(1);
const [routes] = React.useState([
{ key: "first", title: "First" },
{ key: "second", title: "Second" },
]);
return (
<TabView
navigationState={{ index, routes }}
renderScene={renderScene}
onIndexChange={setIndex}
initialLayout={{ width: layout.width }}
/>
);
}
I have 2 tabs and would like to default it to the second scene/tab.
However, the library is rendering the first scene/tab.
Expecting to see SecondRoute on the first mount