From 4699955c5b91194fa52a61b16b748a775224993f Mon Sep 17 00:00:00 2001 From: OmalPerera Date: Mon, 20 Jul 2020 10:42:04 +0530 Subject: [PATCH] #29 : converted text component --- src/atoms/{Text.js => Text.tsx} | 47 +++++++++++++++++---------------- 1 file changed, 24 insertions(+), 23 deletions(-) rename src/atoms/{Text.js => Text.tsx} (70%) diff --git a/src/atoms/Text.js b/src/atoms/Text.tsx similarity index 70% rename from src/atoms/Text.js rename to src/atoms/Text.tsx index f09d61b..a899897 100644 --- a/src/atoms/Text.js +++ b/src/atoms/Text.tsx @@ -1,10 +1,32 @@ import React, { Component } from "react"; -import { Text } from "react-native"; +import { Text , TextProperties} from "react-native"; import PropTypes from "prop-types"; import { commonColors } from "../utils/color"; import { getFontSize } from "../variables/textSizeVariables"; -class TextAE extends Component { +export interface Props extends TextProperties{ + bold: boolean, + color: string, + size: + "h1" | + "h2" | + "h3" | + "h4" | + "h5" | + "h6" | + "p" | + "callout" | + "sub_heading" | + "footnote" | + "caption_big" | + "caption_small", + align: string, + margin: boolean, +} + +interface State{} + +class TextAE extends Component { render() { const { color, @@ -43,27 +65,6 @@ class TextAE extends Component { } } -TextAE.propTypes = { - bold: PropTypes.bool, - color: PropTypes.string, - size: PropTypes.oneOf([ - "h1", - "h2", - "h3", - "h4", - "h5", - "h6", - "p", - "callout", - "sub_heading", - "footnote", - "caption_big", - "caption_small" - ]), - align: PropTypes.string, - margin: PropTypes.bool, - ...Text.propTypes -}; TextAE.defaultProps = { size: "p",