diff --git a/__tests__/__snapshots__/Storyshots.test.js.snap b/__tests__/__snapshots__/Storyshots.test.js.snap index 17a49bfb1..9804e079c 100644 --- a/__tests__/__snapshots__/Storyshots.test.js.snap +++ b/__tests__/__snapshots__/Storyshots.test.js.snap @@ -235,7 +235,177 @@ exports[`Storyshots Message list 1`] = ` } } > - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Message + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + … + + + + + + + - View + + + + + + + + + + + rocket.cat + + + 10:00 AM + + + + + + + Different user + + + + + + + - View + + + + + + + + This is the third message + + + + + + + - View + + + + + + + + This is the second message + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + This is the first message + + + + + + + - View + + + + + + + + Message + + + + + + + - View + + + + + + + + + + + Diego Mello + + + @ + diego.mello + + + 10:00 AM + + + + + + + Message + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Message + + + + (edited) + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Message + + + + + + + - View + + + + + + + + + + + Diego Mello + + + 10:00 AM + + + + + + + Message + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + +   + rocket.cat +   + + + + + +   + diego.mello +   + + + + + +   + all +   + + + + + +   + here +   + + + + + +  # + general +   + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + 👊🤙👏 + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + + + + + + + + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10 November 2017 + + + + + + + Testing + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Reactions + + + + + + View + View + View + View + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Multiple Reactions + + + + + + View + View + View + View + View + View + View + View + View + + + + - View + + + + + + + + + + + rocket.cat + + + 10:00 AM + + + + + + + Fourth message + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Third message + + + + + + + - View + + + + + + + + + + + rocket.cat + + + 10:00 AM + + + + + + + Second message + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + First message + + + + + + + - View + + + + + + + + + + + rocket.cat + + + 10:00 AM + + + + + + + Fourth message + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Third message + + + + + + + - View + + + + + + + + Second message + + + + + + + - View + + + + + + + + + + + rocket.cat + + + 10:00 AM + + + + + + + Second message + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + First message + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + View + + + + + + + This is a title + + + This is a description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + View + + + + + + + This is a title + + + This is a description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + View + + + + + This is a description + + + + + + + + + Video + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + Video + View + + + + + + + + 00:00 + + + + + + + This is a description + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + I’m fine! + + + + + View + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + I’m fine! + + + + + View + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + View + View + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Message + + + + + View + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Message + + + + + View + View + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Broadcasted message + + + + + View + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + This message is inside an archived room + + + + + + + View - View + + + + + + + + This message has error too + + + + + + + View - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + This message has error + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Temp message + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Message being edited + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + Message removed + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + Has joined the channel + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + Room name changed to: New name by diego.mello + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + Message pinned + + View + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + Has left the channel + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + User rocket.cat removed by diego.mello + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + User rocket.cat added by diego.mello + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + User rocket.cat muted by diego.mello + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + User rocket.cat unmuted by diego.mello + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + rocket.cat was set admin by diego.mello + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + rocket.cat is no longer admin by diego.mello + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + Room description changed to: new description by diego.mello + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + Room announcement changed to: new announcement by diego.mello + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + Room topic changed to: new topic by diego.mello + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + Room type changed to: public by diego.mello + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Message + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Italic with + + + + asterisks + + + + or + + + + underscores + + + + . Bold with + + + + asterisks + + + + or + + + + underscores + + + + . + + + + Strikethrough + + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + H1 + + + + + + + H2 + + + + + + + H3 + + + + + + + H4 + + + + + + + H5 + + + + + + + H6 + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Support + + + + Google + + + + + + + + I\`m an inline-style link + + + + https://google.com + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + Inline + + + code + + + has + + + back-ticks around + + + it. + + + + + Code block + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + + Quote + + + + + + + + - View + + + + + + + + + + + diego.mello + + + 10:00 AM + + + + + + + + + + First Header + + + + + + + Second Header + + + + + + + + + + + Content from cell 1 + + + + + + + Content from cell 2 + + + + + + + + + Content in the first column + + + + + + + Content in the second column + + + + + + + + + + { this.showActionSheet(); - Vibration.vibrate(50); + vibrate(); }); } diff --git a/app/containers/message/Message.js b/app/containers/message/Message.js index aead0e65d..943e503f5 100644 --- a/app/containers/message/Message.js +++ b/app/containers/message/Message.js @@ -1,7 +1,7 @@ import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { - View, Text, ViewPropTypes, Image as ImageRN + View, Text, ViewPropTypes, Image as ImageRN, TouchableWithoutFeedback } from 'react-native'; import Icon from 'react-native-vector-icons/MaterialIcons'; import moment from 'moment'; @@ -199,7 +199,7 @@ export default class Message extends PureComponent { if (header) { return ( {this.renderError()} - nativeEvent.state === State.ACTIVE && onLongPress()} + - - - - {this.renderAvatar()} - - {this.renderUsername()} - {this.renderContent()} - {this.renderAttachment()} - {this.renderUrl()} - {this.renderReactions()} - {this.renderBroadcastReply()} - + + {this.renderAvatar()} + + {this.renderUsername()} + {this.renderContent()} + {this.renderAttachment()} + {this.renderUrl()} + {this.renderReactions()} + {this.renderBroadcastReply()} - {reactionsModal - ? ( - - ) - : null - } - - + {reactionsModal + ? ( + + ) + : null + } + + ); } diff --git a/app/containers/message/index.js b/app/containers/message/index.js index 5d135d2b6..4da77d2ae 100644 --- a/app/containers/message/index.js +++ b/app/containers/message/index.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Vibration, ViewPropTypes } from 'react-native'; +import { ViewPropTypes } from 'react-native'; import { connect } from 'react-redux'; import equal from 'deep-equal'; @@ -10,6 +10,7 @@ import { toggleReactionPicker as toggleReactionPickerAction, replyBroadcast as replyBroadcastAction } from '../../actions/messages'; +import { vibrate } from '../../utils/vibration'; @connect(state => ({ baseUrl: state.settings.Site_Url || state.server ? state.server.server : '', @@ -119,7 +120,7 @@ export default class MessageContainer extends React.Component { onReactionLongPress = () => { this.setState({ reactionsModal: true }); - Vibration.vibrate(50); + vibrate(); } get timeFormat() { diff --git a/app/containers/message/styles.js b/app/containers/message/styles.js index b74e9c3c8..540540b2a 100644 --- a/app/containers/message/styles.js +++ b/app/containers/message/styles.js @@ -6,8 +6,12 @@ export default StyleSheet.create({ }, container: { paddingVertical: 5, - flexDirection: 'row', - width: '100%' + width: '100%', + paddingLeft: 10, + paddingRight: 15, + flexDirection: 'column', + transform: [{ scaleY: -1 }], + flex: 1 }, messageContent: { flex: 1, @@ -23,13 +27,6 @@ export default StyleSheet.create({ flexDirection: 'row', flex: 1 }, - message: { - paddingLeft: 10, - paddingRight: 15, - flexDirection: 'column', - transform: [{ scaleY: -1 }], - flex: 1 - }, textInfo: { fontStyle: 'italic', color: '#a0a0a0', diff --git a/app/utils/vibration.js b/app/utils/vibration.js new file mode 100644 index 000000000..a91c3e13c --- /dev/null +++ b/app/utils/vibration.js @@ -0,0 +1,11 @@ +import { Vibration } from 'react-native'; + +import { isAndroid } from './deviceInfo'; + +const vibrate = () => { + if (isAndroid) { + Vibration.vibrate(30); + } +}; + +export { vibrate }; diff --git a/app/views/RoomMembersView/index.js b/app/views/RoomMembersView/index.js index 932e46c62..1a9e86281 100644 --- a/app/views/RoomMembersView/index.js +++ b/app/views/RoomMembersView/index.js @@ -1,8 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { - FlatList, View, Vibration -} from 'react-native'; +import { FlatList, View } from 'react-native'; import ActionSheet from 'react-native-action-sheet'; import { connect } from 'react-redux'; import SafeAreaView from 'react-native-safe-area-view'; @@ -18,6 +16,7 @@ import database from '../../lib/realm'; import { showToast } from '../../utils/info'; import log from '../../utils/log'; import { isAndroid } from '../../utils/deviceInfo'; +import { vibrate } from '../../utils/vibration'; import I18n from '../../i18n'; import SearchBox from '../../containers/SearchBox'; import protectedFunction from '../../lib/methods/helpers/protectedFunction'; @@ -184,7 +183,7 @@ export default class RoomMembersView extends LoggedView { this.actionSheetOptions.push(I18n.t('Mute')); } this.setState({ userLongPressed: user }); - Vibration.vibrate(50); + vibrate(); this.showActionSheet(); }