Skip to content

Commit 566d86f

Browse files
committed
optimization dont render all routes
1 parent d282dff commit 566d86f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ export const TabView: React.FC = (props) => {
4040
}, [props.children]);
4141

4242
const renderScene = ({ route }: { route: any }) => {
43+
if (
44+
Math.abs(index - routes.findIndex((item) => item.key === route.key)) > 2
45+
) {
46+
return <View />;
47+
}
48+
4349
if (scenes.current[route.key]) {
4450
return scenes.current[route.key];
4551
}

0 commit comments

Comments
 (0)