diff --git a/app/components/custom_list/member_list_row.js b/app/components/custom_list/member_list_row.js index d8f64c8da..edc1116a1 100644 --- a/app/components/custom_list/member_list_row.js +++ b/app/components/custom_list/member_list_row.js @@ -55,6 +55,9 @@ const getStyleFromTheme = makeStyleSheetFromTheme((theme) => { alignItems: 'center', justifyContent: 'center' }, + selectorDisabled: { + backgroundColor: '#888' + }, selectorFilled: { backgroundColor: '#378FD2', borderWidth: 0 @@ -71,15 +74,15 @@ function createTouchableComponent(children, action) { } function MemberListRow(props) { - const {id, displayName, username, onPress, theme, user} = props; + const {id, displayName, username, onPress, theme, user, disableSelect} = props; const style = getStyleFromTheme(theme); const RowComponent = ( {props.selectable && - + false : props.onRowSelect}> - + {props.selected && { return StyleSheet.create({ @@ -34,6 +36,7 @@ class ChannelMembers extends PureComponent { currentChannel: PropTypes.object, currentChannelMembers: PropTypes.array.isRequired, currentChannelMemberCount: PropTypes.number.isRequired, + currentUserId: PropTypes.string.isRequired, currentTeam: PropTypes.object, preferences: PropTypes.object, requestStatus: PropTypes.string, @@ -141,6 +144,32 @@ class ChannelMembers extends PureComponent { }); }; + renderMemberRow = (user, sectionId, rowId, preferences, theme, selectable, onPress, onSelect) => { + const {id, username} = user; + const displayName = displayUsername(user, preferences); + let onRowSelect = null; + if (selectable) { + onRowSelect = () => onSelect(sectionId, rowId); + } + + const disableSelect = user.id === this.props.currentUserId; + + return ( + + ); + } + render() { const {currentChannel, isAdmin, theme} = this.props; const canManage = (isAdmin && currentChannel.type !== Constants.DM_CHANNEL && currentChannel.name !== Constants.DEFAULT_CHANNEL); @@ -157,7 +186,7 @@ class ChannelMembers extends PureComponent { loadingText={loadingText} selectable={canManage} onRowSelect={this.handleRowSelect} - renderRow={renderMemberRow} + renderRow={this.renderMemberRow} createSections={createMembersSections} /> diff --git a/app/scenes/channel_members/channel_members_container.js b/app/scenes/channel_members/channel_members_container.js index 62151443f..52774d9c2 100644 --- a/app/scenes/channel_members/channel_members_container.js +++ b/app/scenes/channel_members/channel_members_container.js @@ -26,6 +26,7 @@ function mapStateToProps(state) { currentChannel: getCurrentChannel(state), currentChannelMembers: getProfilesInCurrentChannel(state), currentChannelMemberCount, + currentUserId: state.entities.users.currentId, currentTeam: getCurrentTeam(state), preferences: getMyPreferences(state), requestStatus: state.requests.users.getProfilesInChannel.status,