react-native-menu
Version:
A flexible dropdown menu component for Android and iOS that is similar to Android's Spinner.
30 lines (27 loc) • 815 B
JavaScript
const createClass = require('create-react-class');
module.exports = (React, ReactNative) => {
const { Animated, Platform } = ReactNative;
const TimerMixin = require('react-timer-mixin');
// A component that scales in when mounted.
return createClass({
mixins: [TimerMixin],
getInitialState() {
return { scaleAnim: new Animated.Value(Platform.OS === "android" ? 0.01 : 0.001) };
},
componentDidMount() {
this.setTimeout(() => {
Animated.timing(this.state.scaleAnim, {
duration: 60,
toValue: 1
}).start();
}, 16);
},
render() {
return (
<Animated.View style={[this.props.style, { transform: [ { scale: this.state.scaleAnim } ] }]}>
{ this.props.children }
</Animated.View>
);
}
});
};