import { View, TouchableOpacity, Image as NativeImage, 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 FeedStream from "./FeedStream"; import FollowStream from "./FollowStream"; export default function Stream({ navigation }) { const tailwind = useTailwind(); const insets = useSafeAreaInsets(); const [index, setIndex] = useState(0); //修复ios使用了tab组件闪退问题 const [indicatorX, setIndicatorX] = useState(0); const windowWidth = Dimensions.get("window").width; const tabWidth = windowWidth / 5; return ( { setIndex(e); setIndicatorX(e * tabWidth); }} dense indicatorStyle={{ ...tailwind("h-1 w-10 ml-4 rounded-full"), backgroundColor: "#FF7DCB", transform: [{ translateX: indicatorX }], }} > 推荐 关注 navigation.navigate("Search")} > { setIndex(e); setIndicatorX(e * tabWidth); }} animationType="spring" > ); }