Created
February 6, 2018 08:25
-
-
Save giautm/7815358af7966ec480dae3fd1178ac53 to your computer and use it in GitHub Desktop.
Sketch App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Expo from 'expo'; | |
import * as ExpoPixi from 'expo-pixi'; | |
import React, { Component } from 'react'; | |
import { Image, StyleSheet, View } from 'react-native'; | |
export default class App extends Component { | |
state = { | |
strokeColor: Math.random() * 0xffffff, | |
strokeWidth: Math.random() * 30 + 10, | |
}; | |
onReady = () => { | |
console.log('ready!'); | |
}; | |
render() { | |
return ( | |
<View style={styles.container}> | |
<ExpoPixi.Sketch | |
ref={ref => (this.sketch = ref)} | |
style={styles.sketch} | |
strokeColor={this.state.strokeColor} | |
strokeWidth={this.state.strokeWidth} | |
strokeAlpha={1} | |
onChange={this.onChangeAsync} | |
onReady={this.onReady} | |
/> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
}, | |
sketch: { | |
height: '100%', | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment