react-native-floating-hearts
Periscope floating hearts animation for React Native.
Installation
npm install --save react-native-floating-hearts
Quick start
import React Component from 'react'import View TouchableOpacity StyleSheet from 'react-native'import FloatingHearts from 'react-native-floating-hearts' state = count: 0 { const count = thisstate return <TouchableOpacity = = = > <FloatingHearts = /> </TouchableOpacity> } const styles = StyleSheet
Using a custom shape
import React Component from 'react'import View TouchableOpacity StyleSheet from 'react-native'import FloatingHearts from 'react-native-floating-hearts' state = count: 0 { const count = thisstate return <TouchableOpacity = = = > <FloatingHearts = = /> </TouchableOpacity> } const styles = StyleSheet
Props
Props name | Type | Description | Default |
---|---|---|---|
count* | Number | Adds a heart when incremented | |
color | Number | The hearts color | 'red' |
renderCustomShape | Function | Renders a custom shape instead of a heart |
(*) required
Acknowledgements
Based on this blog post by @browniefed