Skip to content

Instantly share code, notes, and snippets.

@frantic
Created December 15, 2015 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frantic/741a824879e34c1ad375 to your computer and use it in GitHub Desktop.
Save frantic/741a824879e34c1ad375 to your computer and use it in GitHub Desktop.
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
} = React;
var LinearGradient = require('react-native-linear-gradient');
var GradientBug = React.createClass({
render: function() {
return (
<View style={styles.container}>
<LinearGradient
start={[0.5, 1]} end={[1, 1]}
colors={['#6A6AD5', '#6F86D9']}
style={styles.button}>
<Text style={styles.caption}>
BLUE BUTTON
</Text>
</LinearGradient>
<LinearGradient
start={[0.5, 1]} end={[1, 1]}
colors={['#39AAB9', '#9ACEA4']}
style={styles.button}>
<Text style={styles.caption}>
GREEN BUTTON
</Text>
</LinearGradient>
</View>
);
}
});
const HEIGHT = 50;
var styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
button: {
margin: 40,
height: HEIGHT,
borderRadius: HEIGHT / 2,
alignItems: 'center',
justifyContent: 'center',
paddingHorizontal: HEIGHT * 0.7,
backgroundColor: 'transparent',
},
caption: {
letterSpacing: 1,
fontSize: 12,
color: 'white',
},
});
AppRegistry.registerComponent('GradientBug', () => GradientBug);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment