3
0

Text.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. let {
  14. color,
  15. fontSize
  16. } = this.props;
  17. return (
  18. <View style={container || defaultStyle.container}>
  19. <TextInput
  20. style={{...(text || defaultStyle.text), color, fontSize}}
  21. onChangeText={(text) => this.setState({
  22. text
  23. })}
  24. value={this.state.text || 'Default Text'}/>
  25. {this.props.children}
  26. </View>)
  27. }
  28. }
  29. const defaultStyle = StyleSheet.create({
  30. container:{
  31. //border: 0.5px solid #E4E4E4;
  32. borderWidth:0.5,
  33. borderColor:'#E4E4E4',
  34. backgroundColor:'#FFFFFF'
  35. },
  36. text:{
  37. color:'#707070',
  38. textAlign:'center',
  39. font:8,
  40. opacity:0.8
  41. /*
  42. text-align: left;
  43. font: Compact Thin 8px/10px SF Display;
  44. letter-spacing: 0;
  45. color: #707070;
  46. opacity: 0.3;
  47. */
  48. }
  49. })
  50. TextComp.Inputs = {
  51. color: new Types.Text(),
  52. fontSize: new Types.Integer().default(22)
  53. }