diff --git a/example/src/Animated/index.js b/example/src/Animated/index.js index 2c296739e94dc32895e6351f529bf95e9e410e47..3511a3bdb73d5e978f0278f77f7b8fc70c14fd74 100644 --- a/example/src/Animated/index.js +++ b/example/src/Animated/index.js @@ -1,37 +1,29 @@ import React, {Component} from "react"; -import {View, Animated } from "react-native"; +import {View, Animated} from "react-native"; import {AnimatedSurface} from "gl-react-native"; import GL from "gl-react"; -import Dimensions from "Dimensions"; -const { width: viewportW, height: viewportH } = Dimensions.get("window"); -export default class Tests extends Component { +export default class AnimatedExample extends Component { state = { - heightValue: new Animated.Value(200) + heightValue: new Animated.Value(200), }; componentWillMount () { let i = 0; - this.interval = setInterval(() => { + this.interval = setInterval(() => Animated.spring(this.state.heightValue, { toValue: ++i % 2 ? 500 : 200, - }).start(); - }, 1000); + }).start(), 1000); } componentWillUnmount () { clearInterval(this.interval); } render () { const { heightValue } = this.state; - return + return -