Apply StyleSheet.flatten properly to headerStyle. Fixes #3608

This commit is contained in:
Brent Vatne
2018-02-26 14:03:56 -08:00
parent 83ff7e4f17
commit c56a962fb5
2 changed files with 9 additions and 5 deletions

View File

@@ -1,15 +1,22 @@
import React, { Component } from 'react';
import { View } from 'react-native';
import { StyleSheet, View } from 'react-native';
import renderer from 'react-test-renderer';
import StackNavigator from '../StackNavigator';
const styles = StyleSheet.create({
header: {
opacity: 0.5,
},
});
class HomeScreen extends Component {
static navigationOptions = ({ navigation }) => ({
title: `Welcome ${
navigation.state.params ? navigation.state.params.user : 'anonymous'
}`,
gesturesEnabled: true,
headerStyle: [{ backgroundColor: 'red' }, styles.header],
});
render() {

View File

@@ -441,10 +441,7 @@ class Header extends React.PureComponent {
const { options } = this.props.getScreenDetails(scene);
const { headerStyle = {} } = options;
const headerStyleObj =
typeof headerStyle === 'number'
? StyleSheet.flatten(headerStyle)
: headerStyle;
const headerStyleObj = StyleSheet.flatten(headerStyle);
const appBarHeight = getAppBarHeight(isLandscape);
const {