Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<uses-permission android:name="android.permission.VIBRATE"/>
```
5 changes: 4 additions & 1 deletion src/Toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
Animated,
TouchableWithoutFeedback,
View,
Text
Text,
Vibration
} from 'react-native'
import ToastStyles from './ToastStyles'

Expand Down Expand Up @@ -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)

Expand Down