1

這是我在我的router.js文件中的代碼(從react-native-router-flux文檔部分採取):變化場景背景色反應本地路由器通量

import React, { Component } from 'react'; 
import { Router, Scene } from 'react-native-router-flux'; 

import PageOne from './PageOne'; 
import PageTwo from './PageTwo'; 

export default class App extends Component { 
    render() { 
    return (
     <Router> 
     <Scene key="root"> 
      <Scene key="pageOne" component={PageOne} title="PageOne" initial={true} /> 
      <Scene key="pageTwo" component={PageTwo} title="PageTwo" /> 
     </Scene> 
     </Router> 
    ) 
    } 
} 

enter image description here

我如何更改「標題」的背景顏色(上圖中出現「返回」箭頭)?

我想這種方式(增加sceneStyle={{ backgroundColor: 'red'}}):

<Scene key="pageTwo" component={PageTwo} title="PageTwo" sceneStyle={{ backgroundColor: 'red'}} /> 

,但它似乎沒有工作。

FYI:

"react-native": "0.34.1", 
"react-native-router-flux": "^3.35.0" 

回答

1

正如庫API docs描述,你必須爲了改變標題樣式使用navigationBarStyle財產。

試試這個:

<Scene key="pageTwo" component={PageTwo} title="PageTwo" navigationBarStyle={{ backgroundColor: 'red'}} /> 
+0

謝謝你,但我只是發現了這裏的解決方案:https://github.com/aksonov/react-native-router-flux/issues/160。 – splunk

相關問題