diff --git a/app/presentation/UserItem.js b/app/presentation/UserItem.js index 1f536af06..fb61e2bc9 100644 --- a/app/presentation/UserItem.js +++ b/app/presentation/UserItem.js @@ -1,13 +1,14 @@ import React from 'react'; -import { Text, View, StyleSheet } from 'react-native'; +import { + Text, View, StyleSheet, Pressable +} from 'react-native'; import PropTypes from 'prop-types'; import Avatar from '../containers/Avatar'; import { CustomIcon } from '../lib/Icons'; import sharedStyles from '../views/Styles'; import { themes } from '../constants/colors'; -import Touch from '../utils/touch'; -import LongPress from '../utils/longPress'; +import { isIOS } from '../utils/deviceInfo'; const styles = StyleSheet.create({ button: { @@ -43,23 +44,28 @@ const styles = StyleSheet.create({ const UserItem = ({ name, username, onPress, testID, onLongPress, style, icon, baseUrl, user, theme }) => ( - - - - - - {name} - @{username} - - {icon ? : null} + ({ + backgroundColor: isIOS && pressed + ? themes[theme].bannerBackground + : 'transparent' + })} + > + + + + {name} + @{username} - - + {icon ? : null} + + ); UserItem.propTypes = { diff --git a/app/utils/longPress.js b/app/utils/longPress.js deleted file mode 100644 index e491efcb9..000000000 --- a/app/utils/longPress.js +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { State, LongPressGestureHandler } from 'react-native-gesture-handler'; - -class LongPress extends React.Component { - setNativeProps(props) { - this.ref.setNativeProps(props); - } - - getRef = (ref) => { - this.ref = ref; - }; - - longPress = ({ nativeEvent }) => { - const { onLongPress } = this.props; - if (nativeEvent.state === State.ACTIVE) { - if (onLongPress) { - onLongPress(); - } - } - }; - - render() { - const { children, ...props } = this.props; - - return ( - - {children} - - ); - } -} - -LongPress.propTypes = { - children: PropTypes.node, - onLongPress: PropTypes.func -}; - -export default LongPress; diff --git a/app/views/RoomsListView/ServerDropdown.js b/app/views/RoomsListView/ServerDropdown.js index be28fdbf7..64ae0b231 100644 --- a/app/views/RoomsListView/ServerDropdown.js +++ b/app/views/RoomsListView/ServerDropdown.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { - View, Text, Animated, Easing, TouchableWithoutFeedback, TouchableOpacity, FlatList, Image + View, Text, Animated, Easing, TouchableWithoutFeedback, TouchableOpacity, FlatList, Image, Pressable } from 'react-native'; import PropTypes from 'prop-types'; import { connect, batch } from 'react-redux'; @@ -12,7 +12,6 @@ import { toggleServerDropdown as toggleServerDropdownAction } from '../../action import { selectServerRequest as selectServerRequestAction, serverInitAdd as serverInitAddAction } from '../../actions/server'; import { appStart as appStartAction, ROOT_NEW_SERVER } from '../../actions/app'; import styles from './styles'; -import Touch from '../../utils/touch'; import RocketChat from '../../lib/rocketchat'; import I18n from '../../i18n'; import EventEmitter from '../../utils/events'; @@ -21,10 +20,9 @@ import database from '../../lib/database'; import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; import { KEY_COMMAND, handleCommandSelectServer } from '../../commands'; -import { isTablet } from '../../utils/deviceInfo'; +import { isTablet, isIOS } from '../../utils/deviceInfo'; import { localAuthenticate } from '../../utils/localAuthentication'; import { showConfirmationAlert } from '../../utils/info'; -import LongPress from '../../utils/longPress'; import { headerHeight } from '../../containers/Header'; import { goRoom } from '../../utils/goRoom'; @@ -201,37 +199,43 @@ class ServerDropdown extends Component { const { server, theme } = this.props; return ( - (item.id === server || this.remove(item.id))}> - this.select(item.id)} - testID={`rooms-list-header-server-${ item.id }`} - theme={theme} - > - - {item.iconURL - ? ( - console.warn('error loading serverIcon')} - /> - ) - : ( - - ) - } - - {item.name || item.id} - {item.id} - - {item.id === server ? : null} + this.select(item.id)} + onLongPress={() => (item.id === server || this.remove(item.id))} + testID={`rooms-list-header-server-${ item.id }`} + android_ripple={{ + color: themes[theme].bannerBackground + }} + style={({ pressed }) => ({ + backgroundColor: isIOS && pressed + ? themes[theme].bannerBackground + : 'transparent' + })} + > + + {item.iconURL + ? ( + console.warn('error loading serverIcon')} + /> + ) + : ( + + ) + } + + {item.name || item.id} + {item.id} - - + {item.id === server ? : null} + + ); }