import { View, Dimensions } from "react-native"; import React, { useState } from "react"; import { useTailwind } from "tailwind-rn"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { Tab, TabView } from "@rneui/themed"; import AlreadyAddWechat from "./AlreadyAddWechat"; import HaveNotAddWechat from "./HaveNotAddWechat"; export default function WechatWaitingToAdd({ navigation, route }) { const tailwind = useTailwind(); const insets = useSafeAreaInsets(); const [index, setIndex] = useState(route.params?.tab); //修复ios使用了tab组件闪退问题 const [indicatorX, setIndicatorX] = useState(0); const windowWidth = Dimensions.get("window").width; const tabWidth = windowWidth / 2; return ( { setIndex(e); setIndicatorX(e * tabWidth); }} dense indicatorStyle={{ ...tailwind("bg-[#FF7DCB] rounded-full"), transform: [{ translateX: indicatorX }], }} > 待添加 已完成 { setIndex(e); setIndicatorX(e * tabWidth); }} animationType="spring" > ); }