From 5de382330ad3c8a2968d23a9a8bd9478f89a4824 Mon Sep 17 00:00:00 2001 From: Bernard Mordan Date: Thu, 1 Dec 2016 09:41:31 +0000 Subject: [PATCH] toaster messages vibrate the device --- README.md | 8 ++++++++ src/Toast.js | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6468641..1b83385 100644 --- a/README.md +++ b/README.md @@ -198,3 +198,11 @@ export default combineReducers({ connect: (state = null) => state }) ``` + +## Vibration + +Error toasts will vibrate the device if vibration is supported. For compatibility with Android add the following to `AndroidManifest.xml` + +```xml + +``` diff --git a/src/Toast.js b/src/Toast.js index f60174c..fc4cc38 100644 --- a/src/Toast.js +++ b/src/Toast.js @@ -3,7 +3,8 @@ import { Animated, TouchableWithoutFeedback, View, - Text + Text, + Vibration } from 'react-native' import ToastStyles from './ToastStyles' @@ -49,6 +50,8 @@ class Toast extends Component { .timing(animatedValue, { toValue: 1, duration: 350 }) .start() + Vibration.vibrate() + const { duration, onShow } = this.props const timeoutId = setTimeout(() => this.hideToast(), duration + 350)