Compare commits

..

4 Commits

Author SHA1 Message Date
Brent Vatne
5f32a48c16 Release 1.2.1 2018-02-26 14:04:44 -08:00
Brent Vatne
d5a0b5912b Apply StyleSheet.flatten properly to headerStyle. Fixes #3608 2018-02-26 14:04:36 -08:00
Yordis Prieto
13fd8acb20 fix typespec (#3583) 2018-02-26 12:25:13 -08:00
Serhii Palash
8fc8f3b8f7 Fix bug #3279 “Action within RESET doesn't trigger” (#3593)
https://github.com/react-navigation/react-navigation/issues/3279
2018-02-26 12:14:29 -08:00
5 changed files with 24 additions and 13 deletions

View File

@@ -705,7 +705,7 @@ declare module 'react-navigation' {
toString: () => string,
},
init: {
(payload: { params?: NavigationParams }): NavigationInitAction,
(payload?: { params?: NavigationParams }): NavigationInitAction,
toString: () => string,
},
navigate: {

View File

@@ -1,6 +1,6 @@
{
"name": "react-navigation",
"version": "1.2.0",
"version": "1.2.1",
"description": "Routing and navigation for your React Native apps",
"main": "src/react-navigation.js",
"repository": {

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

@@ -392,21 +392,28 @@ export default (routeConfigs, stackConfig = {}) => {
// undefined on either the state or the action
return state;
}
const resetAction = action;
const newStackActions = action.actions;
return {
...state,
routes: resetAction.actions.map(childAction => {
const router = childRouters[childAction.routeName];
routes: newStackActions.map(newStackAction => {
const router = childRouters[newStackAction.routeName];
let childState = {};
if (router) {
const childAction =
newStackAction.action ||
NavigationActions.init({ params: newStackAction.params });
childState = router.getStateForAction(childAction);
}
return {
params: childAction.params,
params: newStackAction.params,
...childState,
routeName: childAction.routeName,
key: childAction.key || generateKey(),
routeName: newStackAction.routeName,
key: newStackAction.key || generateKey(),
};
}),
index: action.index,

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 {