Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -83,6 +77,12 @@ var MaterialButton = React.createClass({
});
},

componentWillUnmount() {
if (this.liftInterval) {
clearInterval(this.liftInterval);
}
},

liftUp() {
Animated.parallel([
Animated.timing(this.state.shadowRadius, {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -220,4 +219,4 @@ var MaterialButton = React.createClass({
}
});

module.exports = MaterialButton;
export default MaterialButton;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -29,6 +29,6 @@
},
"homepage": "https://github.com/recr0ns/react-native-material-button",
"peerDependencies": {
"react-native": ">= 0.9.0"
"react-native": ">= 0.25.0"
}
}
6 changes: 4 additions & 2 deletions styles.js
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -21,3 +21,5 @@ module.exports = React.StyleSheet.create({
overflow: 'visible',
}
});

export default styles;