我有一个a结构,如:
<Tab.Navigator
}}>
<Tab.Screen name="Train" component={Train} options={{
tabBarIcon: ({focused}) => (
<View>
<Image
source={focused ? require('../assets/images/train_use.png') : require('../assets/images/train.png') }
style={{
width: 50,
height: 50,
}}
resizeMode='contain'/>
</View>
),
}}/>
<Tab.Screen name="Result" component={Result} options={{
tabBarButton: () => null,
tabBarStyle: { display: "none" }}}/>
<Tab.Screen name="Statistics" component={Statistics} initialParams={{ wordsInText: 0 }} options={{
tabBarIcon: ({focused}) => (
),
}}/>
<Tab.Screen name="Profile" component={Profile} options={{
tabBarIcon: ({focused})>
),
}}/>
</Tab.Navigator>
我需要发送参数从栈'火车'到栈'统计',我怎么做,请帮助
const [count, setCount] = useState(0); // I need to take this value in Train component
//and take it in the Statistics component
我试着:
routse.params.count
但是不管用,请帮帮忙
1条答案
按热度按时间ubbxdtey1#
尝试将count和setCount作为组件参数传递: