mattermost-mobile/app/screens/select_team/index.js
enahum 248dafbe0e RN-97 Changed navigation from NavigationExperimental to ReactNative Navigation (#540)
* Add react-navigator dependency

* Add react-native-navigation dependency

* react-native-navigation, ios and android config

* update react-native-navigation

* New navigation and code cleanup

* Set ScreenBackgroundColor

* Fix channel drawer event issue

* Applied RNPN non-working popInitial notification

* Android navbar and back button

* packages and notices

* MM-redux update

* Fix draft on team switch

* Remove custom NavBar
2017-05-16 11:19:46 -04:00

45 lines
1.5 KiB
JavaScript

// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {handleTeamChange} from 'app/actions/views/select_team';
import {markChannelAsRead} from 'mattermost-redux/actions/channels';
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentTeam, getTeams, getTeamMemberships} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
import SelectTeam from './select_team.js';
function mapStateToProps(state, ownProps) {
const allTeams = Object.values(getTeams(state));
const myMembers = getTeamMemberships(state);
const user = getCurrentUser(state);
const myTeams = allTeams.filter((team) => myMembers.hasOwnProperty(team.id));
function sortTeams(a, b) {
return a.display_name.localeCompare(b.display_name, user.locale, {numeric: true});
}
return {
...ownProps,
config: state.entities.general.config,
teamsRequest: state.requests.teams.allTeams,
teams: myTeams.sort(sortTeams),
currentTeam: getCurrentTeam(state),
currentChannelId: getCurrentChannelId(state)
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
handleTeamChange,
markChannelAsRead
}, dispatch)
};
}
export default connect(mapStateToProps, mapDispatchToProps)(SelectTeam);