BoolEditor.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import React, { useState } from 'react';
  2. import {View , Text, StyleSheet} from 'react-native';
  3. import { CheckBox } from 'native-base'
  4. export default function BoolEditor(props) {
  5. let [checked, setChecked] = useState(props.checked || '');
  6. let title = props.title || "Input";
  7. return (
  8. <View style={styles.container}>
  9. <Text style={[styles.title, styles.capFirst]}>{title}</Text>
  10. <CheckBox checked={checked}
  11. style={{borderColor: "#36bbad", backgroundColor: checked && "#36bbad"}}
  12. onPress={() => {
  13. props.onChange && props.onChange(!checked);
  14. setChecked(!checked);
  15. }}/>
  16. </View>
  17. );
  18. }
  19. const styles = StyleSheet.create({
  20. container:{
  21. padding:24,
  22. paddingTop: 0,
  23. flexDirection: 'row',
  24. justifyContent: 'space-between',
  25. alignItems: 'baseline'
  26. },
  27. capFirst: {
  28. fontSize: 14,
  29. fontFamily: 'roboto-light',
  30. textTransform: 'capitalize'
  31. },
  32. defaultInput: {
  33. marginTop:6,
  34. borderWidth:1,
  35. backgroundColor: 'white',
  36. boxShadow: '0px 3px 6px #00000029',
  37. borderColor: '#FFFFFF66',
  38. borderRadius: 14
  39. },
  40. title: {
  41. }
  42. })