Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TS migration] Migrate 'InlineSystemMessage.js' component to TypeScript #30234

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Loading