From 0bbf2d1552299e9b983367a19739878b06d0529d Mon Sep 17 00:00:00 2001 From: Viktoryia Kliushun Date: Tue, 24 Oct 2023 09:28:38 +0200 Subject: [PATCH] [TS migration] Migrate 'InlineSystemMessage.js' component --- ...stemMessage.js => InlineSystemMessage.tsx} | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) rename src/components/{InlineSystemMessage.js => InlineSystemMessage.tsx} (62%) diff --git a/src/components/InlineSystemMessage.js b/src/components/InlineSystemMessage.tsx similarity index 62% rename from src/components/InlineSystemMessage.js rename to src/components/InlineSystemMessage.tsx index a6866fb5a887..31d102590681 100644 --- a/src/components/InlineSystemMessage.js +++ b/src/components/InlineSystemMessage.tsx @@ -1,37 +1,32 @@ import React from 'react'; import {View} from 'react-native'; -import PropTypes from 'prop-types'; import styles from '../styles/styles'; import theme from '../styles/themes/default'; import Text from './Text'; import * as Expensicons from './Icon/Expensicons'; import Icon from './Icon'; -const propTypes = { +type InlineSystemMessageProps = { /** Error to display */ - message: PropTypes.string, + message?: string; }; -const defaultProps = { - message: '', -}; - -function InlineSystemMessage(props) { - if (props.message.length === 0) { +function InlineSystemMessage({message = ''}: InlineSystemMessageProps) { + if (!message) { return null; } + return ( - {props.message} + {message} ); } -InlineSystemMessage.propTypes = propTypes; -InlineSystemMessage.defaultProps = defaultProps; InlineSystemMessage.displayName = 'InlineSystemMessage'; + export default InlineSystemMessage;