Created
April 16, 2019 02:19
-
-
Save gbuszmicz/c3474dc5eeca64c9c00ff652a9049edd to your computer and use it in GitHub Desktop.
Pixi slider component for React
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 React, { Component } from 'react' | |
import { Container, Text } from 'react-pixi-fiber' | |
import Slider from 'components/Slider' | |
class MyComponent extends Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
text: '5.0' | |
} | |
} | |
onChange = data => { | |
this.setState({ | |
text: data.value | |
}) | |
} | |
render() { | |
return ( | |
<Container> | |
<Slider | |
width={400} | |
height={25} | |
x={400} | |
y={200} | |
currentPosition={5} | |
onChange={this.onChange} | |
steps={10} | |
/> | |
<Text | |
text={this.state.text} | |
x={400} | |
y={240} | |
style={{ fill: '#888888' }} | |
/> | |
</Container> | |
) | |
} | |
} | |
export default MyComponent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment