index.js 757 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import React from 'react';
  2. import Module from '../../lib/Module';
  3. import {StyleSheet ,TextInput, View, Text } from 'react-native';
  4. import Types from '../../lib/Types';
  5. export default class TextComp extends Module {
  6. constructor(props) {
  7. super(props);
  8. this.state = {
  9. text: props.text || ""
  10. }
  11. }
  12. display() {
  13. let {
  14. text,
  15. color,
  16. fontSize,
  17. fontFamily,
  18. textAlign
  19. } = this.props;
  20. return (
  21. <View>
  22. <Text style={{color, fontSize,fontFamily,textAlign}}>
  23. {text}
  24. </Text>
  25. {this.props.children}
  26. </View>)
  27. }
  28. }
  29. TextComp.Inputs = {
  30. text: new Types.Text().default("Enter Text"),
  31. color: new Types.Text(),
  32. fontSize: new Types.Integer().default(22),
  33. fontFamily: new Types.Text(),
  34. textAlign: new Types.Text()
  35. }