Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 在“标题”中应用多个标题样式;选项“;自然反应_React Native - Fatal编程技术网

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 })}
    />