ColorEditor.js 846 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import React, { useState } from 'react';
  2. import {View , Text, TextInput, Button,StyleSheet} from 'react-native';
  3. import { Icon } from 'react-native-elements'
  4. import SketchPicker from 'react-color';
  5. export default function ColorEditor(props) {
  6. /*let [number , setNumber] = useState(props.number || '')
  7. let title = props.title || "Input";*/
  8. let [color, setColor] = useState(props.color || '');
  9. let title = props.title || "Input";
  10. return(
  11. <View style={styles.container}>
  12. <Text> Color Picker </Text>
  13. <SketchPicker
  14. color={color}
  15. width="180px" onChangeComplete ={(color) =>{
  16. props.onChange && props.onChange(color.hex);
  17. setColor(color)
  18. }}/>
  19. </View>
  20. )
  21. }
  22. const styles = StyleSheet.create({
  23. container:{
  24. padding:10
  25. },
  26. defaultInput: {
  27. marginTop:6,
  28. borderWidth:1,
  29. width:100
  30. },
  31. title: {
  32. }
  33. })