diff --git a/index.js b/index.js index 415a3e8..511f1a7 100644 --- a/index.js +++ b/index.js @@ -1,14 +1,8 @@ -'use strict'; +import React from 'react'; +import { View, Animated, PanResponder } from 'react-native'; +import styles from './styles'; -var React = require('react-native'); -var { - View, - Animated, - PanResponder -} = React; -var styles = require('./styles'); - -var MaterialButton = React.createClass({ +const MaterialButton = React.createClass({ getDefaultProps() { return { withRipple: true, @@ -83,6 +77,12 @@ var MaterialButton = React.createClass({ }); }, + componentWillUnmount() { + if (this.liftInterval) { + clearInterval(this.liftInterval); + } + }, + liftUp() { Animated.parallel([ Animated.timing(this.state.shadowRadius, { @@ -165,7 +165,6 @@ var MaterialButton = React.createClass({ onLayout(e) { var { x, y, width, height } = e.nativeEvent.layout; - console.log(x, y, width, height); this.setState({ top: y, left: x, @@ -220,4 +219,4 @@ var MaterialButton = React.createClass({ } }); -module.exports = MaterialButton; +export default MaterialButton; diff --git a/package.json b/package.json index a8a3e51..249eed6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-material-button", - "version": "0.0.4", + "version": "1.0.0", "description": "Customizable material style button", "main": "index.js", "scripts": { @@ -29,6 +29,6 @@ }, "homepage": "https://github.com/recr0ns/react-native-material-button", "peerDependencies": { - "react-native": ">= 0.9.0" + "react-native": ">= 0.25.0" } } diff --git a/styles.js b/styles.js index a7f066d..6eb59ec 100644 --- a/styles.js +++ b/styles.js @@ -1,6 +1,6 @@ -var React = require('react-native'); +import { StyleSheet } from 'react-native'; -module.exports = React.StyleSheet.create({ +const styles = StyleSheet.create({ rippleContainer: { backgroundColor: 'transparent', overflow: 'hidden', @@ -21,3 +21,5 @@ module.exports = React.StyleSheet.create({ overflow: 'visible', } }); + +export default styles;