Skip to content

Instantly share code, notes, and snippets.

@giautm
Created February 6, 2018 08:25
Show Gist options
  • Save giautm/7815358af7966ec480dae3fd1178ac53 to your computer and use it in GitHub Desktop.
Save giautm/7815358af7966ec480dae3fd1178ac53 to your computer and use it in GitHub Desktop.
Sketch App
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