react-native-hamburger
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -20,5 +20,2 @@ import React, { Component } from 'react'; | ||
if (!this.state.active) { | ||
this.setState({ | ||
active: true | ||
}); | ||
Animated.spring(this.containerAnim, { | ||
@@ -65,5 +62,2 @@ toValue: 1 | ||
if (!this.state.active) { | ||
this.setState({ | ||
active: true | ||
}); | ||
Animated.spring(this.topBar, { | ||
@@ -105,5 +99,2 @@ toValue: .9 | ||
if (!this.state.active) { | ||
this.setState({ | ||
active: true | ||
}); | ||
Animated.spring(this.containerAnim, { | ||
@@ -131,5 +122,2 @@ toValue: 1 | ||
} else { | ||
this.setState({ | ||
active: false | ||
}); | ||
Animated.spring(this.containerAnim, { | ||
@@ -161,5 +149,2 @@ toValue: 0 | ||
if (!this.state.active) { | ||
this.setState({ | ||
active: true | ||
}); | ||
Animated.spring(this.topBar, { | ||
@@ -210,2 +195,7 @@ toValue: 1 | ||
_animate() { | ||
setTimeout(()=> { | ||
this.setState({ | ||
active: this.props.active | ||
}); | ||
}, 0); | ||
const { props: { type } } = this; | ||
@@ -219,6 +209,46 @@ type=="spinArrow" ? this.spinArrow() : | ||
} | ||
componentDidMount() { | ||
setTimeout(()=> { | ||
this.setState({ | ||
active: this.props.active | ||
}); | ||
}, 0); | ||
} | ||
render() { | ||
const { props: { color } } = this; | ||
const { props: { color, type } } = this; | ||
if (this.props.active) { | ||
if (type=="spinArrow") { | ||
this.containerAnim = this.containerAnim || new Animated.Value(1); | ||
this.topBar = this.topBar || new Animated.Value(1); | ||
this.bottomBar = this.bottomBar || new Animated.Value(1); | ||
this.width = this.width || new Animated.Value(14); | ||
this.marginLeft = this.marginLeft || new Animated.Value(-13); | ||
this.bottomBarMargin = this.bottomBarMargin || new Animated.Value(2); | ||
this.topBarMargin = this.topBarMargin || new Animated.Value(-2); | ||
} | ||
else if (type=="arrow") { | ||
this.topBar = this.topBar || new Animated.Value(1); | ||
this.bottomBar = this.bottomBar || new Animated.Value(1); | ||
this.width = this.width || new Animated.Value(14); | ||
this.marginLeft = this.marginLeft || new Animated.Value(-13); | ||
this.bottomBarMargin = this.bottomBarMargin || new Animated.Value(2); | ||
this.topBarMargin = this.topBarMargin || new Animated.Value(-2); | ||
} | ||
else if (type=="spinCross") { | ||
this.containerAnim = this.containerAnim || new Animated.Value(1); | ||
this.topBar = this.topBar || new Animated.Value(0.9); | ||
this.bottomBar = this.bottomBar || new Animated.Value(0.9); | ||
this.bottomBarMargin = this.bottomBarMargin || new Animated.Value(-10); | ||
this.middleBarOpacity = this.middleBarOpacity || new Animated.Value(0); | ||
} | ||
else { | ||
this.topBar = this.topBar || new Animated.Value(0.9); | ||
this.bottomBar = this.bottomBar || new Animated.Value(0.9); | ||
this.bottomBarMargin = this.bottomBarMargin || new Animated.Value(-10); | ||
this.middleBarOpacity = this.middleBarOpacity || new Animated.Value(0); | ||
} | ||
} | ||
this.containerAnim = this.containerAnim || new Animated.Value(0); | ||
@@ -235,3 +265,3 @@ this.topBar = this.topBar || new Animated.Value(0); | ||
<TouchableWithoutFeedback | ||
onPress={()=> {this._animate(), this.props.onPress ? this.props.onPress() : undefined}}> | ||
onPress={()=> {this.props.onPress ? this.props.onPress() : undefined, this._animate()}}> | ||
<Animated.View style={{ | ||
@@ -238,0 +268,0 @@ width: 35, |
{ | ||
"name": "react-native-hamburger", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Hamburger menu for react-native!", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# react-native-hamburger | ||
Hamburger menu for react-native! | ||
Animated fully configurable hamburger menu for react-native! | ||
``` | ||
npm install react-native-hamburger --save | ||
import Hamburger from 'react-native-hamburger'; | ||
``` | ||
![alt tag](gif/hamburger.gif) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143476
6
302
10