Skip to content

Instantly share code, notes, and snippets.

@awareness481
Created August 3, 2018 10:54
Show Gist options
  • Save awareness481/ae0e1401d2bfd35171c70daa756c367f to your computer and use it in GitHub Desktop.
Save awareness481/ae0e1401d2bfd35171c70daa756c367f to your computer and use it in GitHub Desktop.
import React from 'react';
import {
ImageBackground,
StyleSheet,
Text,
TouchableHighlight,
View
} from 'react-native';
import { Font } from 'expo';
const background = require('./assets/bg.jpeg');
export default class App extends React.Component {
constructor(props) {
super(props);
state = {
fontLoaded: false,
}
}
onButtonPress = () => {
console.log('hello');
}
async componentDidMount() {
await Font.loadAsync({
'source400': require('./assets/fonts/SourceSansPro-Regular.ttf'),
});
this.setState({ fontLoaded: true });
}
render() {
return (
<View style={styles.container}>
<ImageBackground
source={background}
style={{width: '100%', height: '100%'}}
>
<TouchableHighlight
style={styles.button}
onPress={this.onButtonPress}
>
{ this.state.fontLoaded
? (<Text style={styles.touchText}> Get Started ────────></Text>)
: null
}
</TouchableHighlight>
</ImageBackground>
</View>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment