내 React 네이티브 앱에 React Navigation을 구현하고 있는데 헤더의 배경색과 전경색을 변경하고 싶습니다. 나는 다음을 가지고있다 :React 네이티브, React Navigation 헤더 스타일 변경
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import { StackNavigator } from 'react-navigation';
export default class ReactNativePlayground extends Component {
static navigationOptions = {
title: 'Welcome',
};
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
const SimpleApp = StackNavigator({
Home: { screen: ReactNativePlayground }
});
AppRegistry.registerComponent('ReactNativePlayground',() => SimpleApp);
기본적으로 배경색은 흰색이고 검은 색 전경색이다. 나는 또한 React Navigation에 대한 문서를 살펴 봤지만 스타일을 설정하는 방법을 찾을 수는 없다. 어떤 도움이 필요합니까? 당신이 navigationOptions 개체를 수정, 워드 프로세서 당
, here :
static navigationOptions = {
title: 'Chat',
headerStyle: { backgroundColor: 'red' },
headerTitleStyle: { color: 'green' },
}
되지 않는 답 : 새 버전에서
도현을보십시오! 나는 문서의 잘못된 부분을보고 있었다. 감사합니다. – Tiwaz89
문제 없습니다, 제가 어제 이것을하고 있었다는 사실이 내가 도울 수있는 유일한 이유입니다. 나는 그것을 찾기 위해 문서를 샅샅이 조사해야했습니다. 나는 그것이 전부가 아니었기 때문에 기쁘다. ReactNavigation에 대한 문제가 너무 많으면 4를 확인하십시오.ReactRouter의 0 번 분기에는 네이티브 바인딩이 있습니다. – cssko
신난다. 나는 그것을 다시 할 것이다라고 생각한다, 다시 한번 감사드립니다! :) – Tiwaz89