TextEditor.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import React, { useState } from 'react';
  2. import {View , Text, TextInput, Button,StyleSheet} from 'react-native';
  3. import { Icon } from 'react-native-elements'
  4. export default function TextEditor(props) {
  5. let [text, setText] = useState(props.value || '');
  6. let title = props.title || "";
  7. return (
  8. <View style={styles.container}>
  9. <Text style={[styles.title, styles.capFirst]}>{title}</Text>
  10. <TextInput style={styles.defaultInput}
  11. onChangeText={(text) => {
  12. props.onChange && props.onChange(text);
  13. setText(text);
  14. }}
  15. value={text}/>
  16. </View>
  17. );
  18. }
  19. const styles = StyleSheet.create({
  20. container:{
  21. flexDirection: 'row',
  22. justifyContent: 'space-between',
  23. alignItems: 'baseline'
  24. },
  25. capFirst: {
  26. fontSize: 14,
  27. fontFamily: 'roboto-light',
  28. textTransform: 'capitalize'
  29. },
  30. defaultInput: {
  31. marginTop:6,
  32. borderWidth:1,
  33. backgroundColor: 'white',
  34. boxShadow: '0px 3px 6px #00000029',
  35. borderColor: '#FFFFFF66',
  36. borderRadius: 14
  37. },
  38. title: {
  39. }
  40. })
  41. /*
  42. <View style={SideBarStyle.body}>
  43. <Text>{key}</Text>
  44. <TextInput
  45. style={{height: 40, borderColor: 'gray', borderWidth: 1}}
  46. onChangeText={(text) => this.editNode(text, key, Structure[key])}
  47. value={this.viewNode.props[key]}
  48. keyboardType={Structure[key].constructor.name === 'Interger' ? 'numeric':null}
  49. />
  50. </View>
  51. */