Skip to content

Commit

Permalink
Merge pull request #30234 from VickyStash/ts-migration/inlineSystemMe…
Browse files Browse the repository at this point in the history
…ssage-component

[TS migration] Migrate 'InlineSystemMessage.js' component to TypeScript
  • Loading branch information
Gonals authored Oct 26, 2023
2 parents 2d52929 + 0bbf2d1 commit 91642d2
Showing 1 changed file with 7 additions and 12 deletions.
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;

0 comments on commit 91642d2

Please sign in to comment.