Animate a react-native component with gravity and bouncing effect.
npm install react-native-reanimated-bounce bash
yarn add react-native-reanimated react-native-reanimated-bounce
`
change babel.config.js to:
` js
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: ['react-native-reanimated/plugin'] // add this line to existing file
};
};
`
Usage
` js
import * as React from 'react'
import { StyleSheet, Text, View, Button } from 'react-native';
import Animated, {
withTiming
} from 'react-native-reanimated'
import BounceView from 'react-native-reanimated-bounce'
export default function App() {
const animate = React.useRef(null)
return (
}/>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
}
});
``