Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- import PropTypes from 'prop-types';
- import { Animated, Easing } from 'react-native';
- export default class SlideRightView extends Component {
- state = {
- positionX: new Animated.Value(-350)
- };
- componentDidMount() {
- setTimeout(() => {
- Animated.timing(this.state.positionX, {
- toValue: 0,
- easing: Easing.bounce,
- duration: 600
- }).start();
- }, 200);
- }
- render() {
- let { positionX } = this.state;
- return (
- <Animated.View
- style={{
- ...this.props.style,
- right: positionX
- }}>
- {this.props.children}
- </Animated.View>
- );
- }
- }
- SlideRightView.propTypes = {
- children: PropTypes.any,
- style: PropTypes.object
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement