diff --git a/app/screens/thread/thread.js b/app/screens/thread/thread.js index 0c538ca4c..4cb07a255 100644 --- a/app/screens/thread/thread.js +++ b/app/screens/thread/thread.js @@ -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, diff --git a/app/screens/user_profile/user_profile.js b/app/screens/user_profile/user_profile.js index e1d345595..e0e206aab 100644 --- a/app/screens/user_profile/user_profile.js +++ b/app/screens/user_profile/user_profile.js @@ -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(); } };