added closing post button when change routes

This commit is contained in:
ue 2018-11-26 11:15:57 +03:00
parent 9039e04600
commit 21a5cc38dc
5 changed files with 17 additions and 9 deletions

View File

@ -5,6 +5,7 @@ export default EStyleSheet.create({
flex: 1,
flexDirection: 'column',
height: '$deviceHeight / 4',
backgroundColor: '$primaryBackgroundColor',
},
body: {
flexDirection: 'row',

View File

@ -47,6 +47,6 @@ export default EStyleSheet.create({
height: 20,
},
disableTouchable: {
backgroundColor:"$iconColor",
backgroundColor: '$iconColor',
},
});

View File

@ -27,7 +27,7 @@ class PostButtonContainer extends Component {
}
const mapStateToProps = state => ({
isLoggedIn: state.application.isLoggedIn,
routes: state.nav.routes,
});
export default connect(mapStateToProps)(withNavigation(PostButtonContainer));

View File

@ -22,6 +22,6 @@ export default EStyleSheet.create({
justifyContent: 'center',
shadowColor: '$shadowColor',
shadowOffset: { height: 0 },
shadowOpacity: 1,
shadowOpacity: 0.5,
},
});

View File

@ -26,6 +26,16 @@ class PostButtonView extends Component {
icon3 = new Animated.Value(0);
componentWillReceiveProps(nextProps) {
const { routes } = this.props;
const nextRouteName = nextProps.routes[0].routes[nextProps.routes[0].routes.length - 1].routeName;
const routeName = routes[0].routes[routes[0].routes.length - 1].routeName;
// For closing sub buttons
if (routeName !== nextRouteName && nextRouteName !== 'MainDrawer') {
this.toggleView();
}
}
toggleView = () => {
if (this.mode._value) {
Animated.parallel(
@ -95,8 +105,7 @@ class PostButtonView extends Component {
top: firstY,
}}
icon="camera"
onPress={() => handleSubButtonPress(ROUTES.SCREENS.EDITOR)
}
onPress={() => handleSubButtonPress(ROUTES.SCREENS.EDITOR)}
/>
<SubPostButton
size={SIZE}
@ -105,8 +114,7 @@ class PostButtonView extends Component {
top: secondY,
}}
icon="pencil"
onPress={() => handleSubButtonPress(ROUTES.SCREENS.EDITOR)
}
onPress={() => handleSubButtonPress(ROUTES.SCREENS.EDITOR)}
/>
<SubPostButton
size={SIZE}
@ -115,8 +123,7 @@ class PostButtonView extends Component {
top: thirdY,
}}
icon="video-camera"
onPress={() => handleSubButtonPress(ROUTES.SCREENS.EDITOR)
}
onPress={() => handleSubButtonPress(ROUTES.SCREENS.EDITOR)}
/>
<TouchableOpacity onPress={this.toggleView} activeOpacity={1}>
<Animated.View