-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30234 from VickyStash/ts-migration/inlineSystemMe…
…ssage-component [TS migration] Migrate 'InlineSystemMessage.js' component to TypeScript
- Loading branch information
Showing
1 changed file
with
7 additions
and
12 deletions.
There are no files selected for viewing
19 changes: 7 additions & 12 deletions
19
src/components/InlineSystemMessage.js → src/components/InlineSystemMessage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<View style={[styles.flexRow, styles.alignItemsCenter]}> | ||
<Icon | ||
src={Expensicons.Exclamation} | ||
fill={theme.danger} | ||
/> | ||
<Text style={[styles.inlineSystemMessage]}>{props.message}</Text> | ||
<Text style={styles.inlineSystemMessage}>{message}</Text> | ||
</View> | ||
); | ||
} | ||
|
||
InlineSystemMessage.propTypes = propTypes; | ||
InlineSystemMessage.defaultProps = defaultProps; | ||
InlineSystemMessage.displayName = 'InlineSystemMessage'; | ||
|
||
export default InlineSystemMessage; |