久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

React Navigation 切換背景顏色和樣式 StackNavigator

React Navigation switching background colors and styling StackNavigator(React Navigation 切換背景顏色和樣式 StackNavigator)
本文介紹了React Navigation 切換背景顏色和樣式 StackNavigator的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我是 React Native 的新手,但我有一個(gè)簡(jiǎn)單的工作應(yīng)用程序,其中包含三個(gè)場(chǎng)景.我以前使用過(guò) Navigator,但感覺(jué)很慢,很高興嘗試 React Navigation(如 https://reactnavigation.org/).實(shí)施 React Navigation 后,我的背景顏色從白色變?yōu)榛疑瑥幕疑優(yōu)榘咨?這很奇怪,不應(yīng)該相關(guān).但是我沒(méi)有改變我的風(fēng)格.我只實(shí)現(xiàn)了新的導(dǎo)航并且顏色改變了.當(dāng)我回到 Navigator 時(shí),我的顏色又回來(lái)了.我正在使用 StackNavigator.有沒(méi)有其他人遇到過(guò)這種奇怪的現(xiàn)象?

I'm fairly new to React Native, but I have a simple working app with three scenes. I was previously using Navigator but it felt laggy and was excited to try out React Navigation (as in https://reactnavigation.org/). After implementing React Navigation, my background color switched from white to grey, and what was grey to white. This is a strange and shouldn't be related. However I didn't change my styles. I only implemented the new navigation and the colors changed. When I revert back to Navigator my colors return. I'm using StackNavigator. Has anyone else encountered this strange phenomenon?

或者更好的問(wèn)題是:如何在 React Navigation 的 StackNavigator 中設(shè)置標(biāo)題和背景顏色的樣式?

Or maybe a better question is : how do I style my header and background color in React Navigation's StackNavigator?

推薦答案

要在 React Navigation 中設(shè)置標(biāo)題樣式,請(qǐng)?jiān)?navigationOptions 對(duì)象中使用標(biāo)題對(duì)象:

To style the header in React Navigation use a header object inside the navigationOptions object:

static navigationOptions = {  
  header: {
    titleStyle: {
     /* this only styles the title/text (font, color etc.)  */
    },
    style: {
     /* this will style the header, but does NOT change the text */
    },
    tintColor: {
      /* this will color your back and forward arrows or left and right icons */
    }
  }
}

要設(shè)置 backgroundColor 的樣式,您只需在應(yīng)用中設(shè)置 backgroundColor 否則您將獲得默認(rèn)顏色.

For styling the backgroundColor, you just need to set the backgroundColor in your app otherwise you'll get the default color.

更新!!從 2017 年 5 月 beta9 開(kāi)始,navigationOptions 現(xiàn)在是平的

您可以在此處閱讀有關(guān)重大更改的信息

您需要從標(biāo)頭對(duì)象中刪除對(duì)象鍵.另外,請(qǐng)注意它們已被重命名.

You need to remove the object keys from the header object. Also, notice they have been renamed.

static navigationOptions = {
   title: 'some string title',
   headerTitleStyle: {
      /*  */
   },
   headerStyle: {
      /*  */
   },
   headerTintColor: {
      /*  */
   },
}

這篇關(guān)于React Navigation 切換背景顏色和樣式 StackNavigator的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機(jī)器人提及發(fā)出該機(jī)器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復(fù)必須使用導(dǎo)入來(lái)加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來(lái)自特定服務(wù)器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復(fù)“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務(wù)器時(shí)的歡迎消息)
主站蜘蛛池模板: 日韩精品人成在线播放 | 麻豆久久久9性大片 | 久久精品久久久 | 一区二区三区免费 | 国产四区 | 色综网 | 国产99视频精品免视看9 | 欧美不卡一区二区三区 | 午夜在线视频一区二区三区 | 桃色五月| 91中文字幕在线 | 日韩免费一区二区 | 高清久久| 国产一级片免费看 | 日本成人在线免费视频 | 亚欧洲精品在线视频免费观看 | 精品成人一区二区 | 一区二区三区久久 | 超碰日本 | 亚洲综合视频一区 | 中文字幕精品视频 | 日一区二区 | 日本天堂视频 | 一区二区三区四区不卡视频 | 久久久91精品国产一区二区三区 | 免费精品 | 天天夜碰日日摸日日澡 | 五月婷婷激情网 | 日韩在线欧美 | 一级毛片视频 | 欧美久久电影 | 久久国产精品久久 | 中文字幕日韩在线观看 | 九九九久久国产免费 | jizz在线免费观看 | 91视频中文| 中文字幕国产视频 | 国产精品视频一二三区 | 欧美一区二区三区,视频 | 久久久激情 | 亚洲三区在线 |