index.js 646 B

1234567891011121314151617181920212223242526272829303132333435
  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. } = this.props;
  18. return (
  19. <View>
  20. <Text style={{color, fontSize}}>
  21. {text}
  22. </Text>
  23. {this.props.children}
  24. </View>)
  25. }
  26. }
  27. TextComp.Inputs = {
  28. text: new Types.Text().default("Enter Text"),
  29. color: new Types.Text(),
  30. fontSize: new Types.Integer().default(22)
  31. }