1

ログインとホームの2つのシーンがあり、両方の背景色が黒に設定されています。しかし、移行中にマウントを解除してマウントすると、別の背景が白いように見えます。React Native + react-native-router-flux:移行中に背景色が白くなるのはなぜですか?

背景が何であるか把握し、色を黒に変更する方法はありますか?ここで

は私のセットアップです:白い示すとトランジションの

const RouterWithRedux = connect()(Router) 
const store = configureStore() 

    export default class App extends Component { 
     render() { 
     return (
      <Provider store={store}> 
      <RouterWithRedux> 
       <Scene key='root'> 
       <Scene component={Login} initial={true} key='login' sceneStyle={{backgroundColor: 'black'}} title='Login'/> 
       <Scene component={Home} direction='vertical' key='Home' sceneStyle={{backgroundColor: 'black'}} title='Home'/> 
       </Scene> 
      </RouterWithRedux> 
      </Provider> 
     ) 
     } 
    } 

と画像、参照するには、ハードの種類がありますが、バッテリーアイコン右上を見れば、空白は右に、上にありますログインシーンがダウンして行くの(ホームへのログインからとして、及びログインがあることの過程にあったアンマウントそうだった半透明の黒):

enter image description here

答えて

2

は、スタイルやを返すgetSceneStyleに関数を渡します210オブジェクト。

// .. 
const getSceneStyle = (/* NavigationSceneRendererProps */ props, computedProps) => { 
    const style = { 
    backgroundColor: 'black', 
    }; 
    return style; 
}; 
// .. 
<RouterWithRedux getSceneStyle={getSceneStyle}> 
// .. 

、下記行うだけでストレート小道具を渡すRouterWithReduxに、connectRouterコンポーネントにそれを通過するしないでください。

const RouterWithRedux = connect()(<Router sceneStyle={{backgroundColor: 'black'}}/>) 
関連する問題