Compare commits

..

7 Commits

Author SHA1 Message Date
Brent Vatne
b9d55a6330 Release 1.5.2 2018-03-12 11:12:31 -07:00
Brent Vatne
315e43701b Fix tab icon height on horizontal / ipad 2018-03-12 11:12:22 -07:00
Hugo Dozois
1d573bc246 Fix isFocused from withNavigationFocus is a function (#3710)
Fixes #3709
2018-03-11 22:26:33 +01:00
Eric Vicenti
3bfb0b90d0 Fix onTransitionEnd props passthrough
Fixes #3647
2018-03-10 00:09:02 -08:00
Brent Vatne
8a129afe13 Release 1.5.1 2018-03-09 11:33:06 -08:00
Brent Vatne
ab2a63fe92 Update snapshot for tab icon changes 2018-03-09 11:32:53 -08:00
Brandon Smith
c411210ecc Pass initialRouteKey into StackRouter (#3540) (#3701) 2018-03-09 11:31:41 -08:00
6 changed files with 27 additions and 15 deletions

View File

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

View File

@@ -11,6 +11,7 @@ import NavigationActions from '../NavigationActions';
export default (routeConfigMap, stackConfig = {}) => {
const {
initialRouteKey,
initialRouteName,
initialRouteParams,
paths,
@@ -25,6 +26,7 @@ export default (routeConfigMap, stackConfig = {}) => {
} = stackConfig;
const stackRouterConfig = {
initialRouteKey,
initialRouteName,
initialRouteParams,
paths,
@@ -47,7 +49,7 @@ export default (routeConfigMap, stackConfig = {}) => {
onTransitionEnd={(lastTransition, transition) => {
const { state, dispatch } = props.navigation;
dispatch(NavigationActions.completeTransition({ key: state.key }));
onTransitionEnd && onTransitionEnd();
onTransitionEnd && onTransitionEnd(lastTransition, transition);
}}
/>
)

View File

@@ -100,6 +100,7 @@ class TabBarBottom extends React.PureComponent {
if (showIcon === false) {
return null;
}
return (
<TabBarIcon
position={position}
@@ -108,7 +109,11 @@ class TabBarBottom extends React.PureComponent {
inactiveTintColor={inactiveTintColor}
renderIcon={renderIcon}
scene={scene}
style={showLabel && this._shouldUseHorizontalTabs() ? {} : styles.icon}
style={
showLabel && this._shouldUseHorizontalTabs()
? styles.horizontalIcon
: styles.icon
}
/>
);
};
@@ -286,6 +291,9 @@ class TabBarBottom extends React.PureComponent {
}
}
const DEFAULT_HEIGHT = 49;
const COMPACT_HEIGHT = 29;
const styles = StyleSheet.create({
tabBar: {
backgroundColor: '#F7F7F7', // Default background color in iOS 10
@@ -294,10 +302,10 @@ const styles = StyleSheet.create({
flexDirection: 'row',
},
tabBarCompact: {
height: 29,
height: COMPACT_HEIGHT,
},
tabBarRegular: {
height: 49,
height: DEFAULT_HEIGHT,
},
tab: {
flex: 1,
@@ -314,6 +322,9 @@ const styles = StyleSheet.create({
icon: {
flexGrow: 1,
},
horizontalIcon: {
height: Platform.isPad ? DEFAULT_HEIGHT : COMPACT_HEIGHT,
},
label: {
textAlign: 'center',
backgroundColor: 'transparent',

View File

@@ -23,6 +23,7 @@ export default class TabBarIcon extends React.PureComponent {
inputRange,
outputRange: inputRange.map(i => (i === index ? 0 : 1)),
});
// We render the icon twice at the same position on top of each other:
// active and inactive one, so we can fade between them.
return (

View File

@@ -93,13 +93,12 @@ exports[`TabBarBottom renders successfully 1`] = `
style={
Object {
"alignItems": "center",
"bottom": 0,
"alignSelf": "center",
"height": "100%",
"justifyContent": "center",
"left": 0,
"opacity": 1,
"position": "absolute",
"right": 0,
"top": 0,
"width": "100%",
}
}
/>
@@ -108,13 +107,12 @@ exports[`TabBarBottom renders successfully 1`] = `
style={
Object {
"alignItems": "center",
"bottom": 0,
"alignSelf": "center",
"height": "100%",
"justifyContent": "center",
"left": 0,
"opacity": 0,
"position": "absolute",
"right": 0,
"top": 0,
"width": "100%",
}
}
/>

View File

@@ -31,7 +31,7 @@ export default function withCachedChildNavigation(Comp) {
});
}
_isRouteFocused = route => () => {
_isRouteFocused = route => {
const { state } = this.props.navigation;
const focusedRoute = state.routes[state.index];
return route === focusedRoute;
@@ -58,7 +58,7 @@ export default function withCachedChildNavigation(Comp) {
this._childNavigationProps[route.key] = addNavigationHelpers({
dispatch: navigation.dispatch,
state: route,
isFocused: this._isRouteFocused.bind(this, route),
isFocused: () => this._isRouteFocused(route),
addListener: this._childEventSubscribers[route.key],
});
});