React native 在“标题”中应用多个标题样式;选项“;自然反应
这是我的屏幕:React native 在“标题”中应用多个标题样式;选项“;自然反应,react-native,React Native,这是我的屏幕: <Stack.Screen name="accountType" options={[({route} => { title: route.params.username, {headerStyle} )]}> 你知道怎么做吗?你可以像下面这样做,这将添加headerStyle和参数 options={({ route }) => ({ title: route.params.username,
<Stack.Screen
name="accountType"
options={[({route} => {
title: route.params.username,
{headerStyle}
)]}>
你知道怎么做吗?你可以像下面这样做,这将添加headerStyle和参数
options={({ route }) => ({ title: route.params.username,...headerStyle })}
完整代码如下所示
<Stack.Screen
name="accountType"
component={AccountType}
options={({ route }) => ({ title: route.params.username,...headerStyle })}
/>
({title:route.params.username,…headerStyle})
/>
什么是headerStyle?@GuruparanGiritharan这是一个变量。刚刚更新了我的代码。你会看到我把它包括在堆栈屏幕的选项中
道具中这就像一个符咒!你能解释一下点符号吗?好的,那么选项需要一个对象,所以我们将你的对象和你提供的标题一起展开,如果你在自定义对象中有一个默认标题,那么应该在那之后添加标题。你可以从这里获得更多信息
<Stack.Screen
name="accountType"
component={AccountType}
options={({ route }) => ({ title: route.params.username,...headerStyle })}
/>