Fixes Android dismissModal from user_profile and thread screens (#1191)
* Android fix dismissModal from user profile * Android fix dismissModal when no posts in thread
This commit is contained in:
parent
f651cac583
commit
d5d59822e6
2 changed files with 33 additions and 5 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import React, {PureComponent} from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {Platform} from 'react-native';
|
||||
import {injectIntl, intlShape} from 'react-intl';
|
||||
|
||||
import {General} from 'mattermost-redux/constants';
|
||||
|
|
@ -48,7 +49,7 @@ class Thread extends PureComponent {
|
|||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (this.props.postIds !== nextProps.postIds && !nextProps.postIds.length) {
|
||||
this.props.navigator.pop();
|
||||
this.close();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -61,6 +62,20 @@ class Thread extends PureComponent {
|
|||
this.props.actions.selectPost('');
|
||||
}
|
||||
|
||||
close = () => {
|
||||
const {navigator} = this.props;
|
||||
|
||||
if (Platform.OS === 'ios') {
|
||||
navigator.pop({
|
||||
animated: true
|
||||
});
|
||||
} else {
|
||||
navigator.dismissModal({
|
||||
animationType: 'slide-down'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
channelId,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
import React, {PureComponent} from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
Platform,
|
||||
ScrollView,
|
||||
Text,
|
||||
View,
|
||||
|
|
@ -39,6 +40,20 @@ class UserProfile extends PureComponent {
|
|||
user: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
close = () => {
|
||||
const {navigator} = this.props;
|
||||
|
||||
if (Platform.OS === 'ios') {
|
||||
navigator.popToRoot({
|
||||
animated: true
|
||||
});
|
||||
} else {
|
||||
navigator.dismissModal({
|
||||
animationType: 'slide-down'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
displaySendMessageOption = () => {
|
||||
const {currentChannel, currentUserId, user} = this.props;
|
||||
|
||||
|
|
@ -75,7 +90,7 @@ class UserProfile extends PureComponent {
|
|||
};
|
||||
|
||||
sendMessage = async () => {
|
||||
const {actions, currentDisplayName, intl, teammateNameDisplay, navigator, user} = this.props;
|
||||
const {actions, currentDisplayName, intl, teammateNameDisplay, user} = this.props;
|
||||
|
||||
// save the current channel display name in case it fails
|
||||
const currentChannelDisplayName = currentDisplayName;
|
||||
|
|
@ -98,9 +113,7 @@ class UserProfile extends PureComponent {
|
|||
}
|
||||
);
|
||||
} else {
|
||||
navigator.popToRoot({
|
||||
animated: true
|
||||
});
|
||||
this.close();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue