Text.js 1006 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import React from 'react';
  2. import Module from '../lib/Module';
  3. import {StyleSheet ,TextInput, View, Text } from 'react-native';
  4. export default class TextComp extends Module {
  5. constructor(props) {
  6. super(props);
  7. this.state = {
  8. text: props.text || ""
  9. }
  10. }
  11. display() {
  12. let { container , text } = this.props.style || ""
  13. return (
  14. <View style={container || defaultStyle.container}>
  15. <TextInput
  16. style={text || defaultStyle.text}
  17. onChangeText={(text) => this.setState({
  18. text
  19. })}
  20. value={this.state.text || 'Default Text'}/>
  21. {this.props.children}
  22. </View>)
  23. }
  24. }
  25. const defaultStyle = StyleSheet.create({
  26. container:{
  27. //border: 0.5px solid #E4E4E4;
  28. borderWidth:0.5,
  29. borderColor:'#E4E4E4',
  30. backgroundColor:'#FFFFFF'
  31. },
  32. text:{
  33. color:'#707070',
  34. textAlign:'center',
  35. font:8,
  36. opacity:0.8
  37. /*
  38. text-align: left;
  39. font: Compact Thin 8px/10px SF Display;
  40. letter-spacing: 0;
  41. color: #707070;
  42. opacity: 0.3;
  43. */
  44. }
  45. })