TextEditor.js 695 B

123456789101112131415161718192021222324252627282930313233
  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.text || '');
  6. let title = props.title || "Input";
  7. return (
  8. <View style={styles.container}>
  9. <Text style={styles.title}>{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. padding:0,
  22. borderWidth:1
  23. },
  24. defaultInput: {
  25. },
  26. title: {
  27. }
  28. })