Skip to content

Commit

Permalink
swipe to dismiss notifications (#670)
Browse files Browse the repository at this point in the history
* swipe to dismiss notifications

* exact match version

* fix tap and opacity
  • Loading branch information
brunobar79 authored May 25, 2019
1 parent 7eff520 commit 4fc863b
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 20 deletions.
23 changes: 19 additions & 4 deletions app/components/UI/TransactionNotification/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Fragment } from 'react';
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
import { TouchableOpacity, StyleSheet, View, Text } from 'react-native';
import PropTypes from 'prop-types';
import { colors, baseStyles, fontStyles } from '../../../styles/common';
import ElevatedView from 'react-native-elevated-view';
Expand All @@ -9,6 +9,7 @@ import DeviceSize from '../../../util/DeviceSize';
import AnimatedSpinner from '../AnimatedSpinner';
import { hideMessage } from 'react-native-flash-message';
import { strings } from '../../../../locales/i18n';
import GestureRecognizer from 'react-native-swipe-gestures';

const styles = StyleSheet.create({
defaultFlashFloating: {
Expand Down Expand Up @@ -115,9 +116,23 @@ export const TransactionNotification = props => {

return (
<ElevatedView elevation={10} style={baseStyles.flex}>
<TouchableOpacity style={[styles.defaultFlash, styles.defaultFlashFloating]} onPress={this._onPress}>
{this._getContent()}
</TouchableOpacity>
<GestureRecognizer
// eslint-disable-next-line react/jsx-no-bind
onSwipeDown={() => hideMessage()}
config={{
velocityThreshold: 0.2,
directionalOffsetThreshold: 50
}}
style={baseStyles.flex}
>
<TouchableOpacity
style={[styles.defaultFlash, styles.defaultFlashFloating]}
onPress={this._onPress}
activeOpacity={0.8}
>
{this._getContent()}
</TouchableOpacity>
</GestureRecognizer>
</ElevatedView>
);
};
Expand Down
56 changes: 40 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"react-native-search-api": "1.2.0",
"react-native-share": "1.1.3",
"react-native-svg": "9.3.3",
"react-native-swipe-gestures": "1.0.3",
"react-native-vector-icons": "6.3.0",
"react-native-view-shot": "2.5.0",
"react-native-web3-webview": "1.3.1",
Expand Down

0 comments on commit 4fc863b

Please sign in to comment.