我正在制作React Native Expo应用程序。我有标题放在我将图像作为背景。我想在此图像上放背景色,但是当我写背景色时,它不起作用。我如何将背景色放在标题中的图像上 代码:
navigationOptions: {
headerTintColor: 'white',
headerBackground: (
<Image
source = {{ uri: "http://rapprogtrain.com/img/new/computer-2788918_1280.jpg" }}
style={{resizeMode:'cover', width: Dimensions.get('window').width,
height:250, backgroundColor:'#1e1e21' }}
/>
),
},
答案 0 :(得分:0)
您可以尝试以下操作:
navigationOptions: {
headerStyle: {{ backgroundColor:'#1e1e21' }}
}
答案 1 :(得分:0)
您可以使用工具栏。可以更改backgroundcolor。
example.js
import {ToolbarAndroid} from "react-native"
render: function() {
return (
<ToolbarAndroid
style={{backgroundColor:'#1e1e21'}}
logo={require('./app_logo.png')}
title="AwesomeApp"
actions={[{title: 'Settings', icon: require('./icon_settings.png'), show: 'always'}]}
onActionSelected={this.onActionSelected} />
)
},
onActionSelected: function(position) {
if (position === 0) { // index of 'Settings'
showSettings();
}
}