From 8687ed3d7d256eead17234d75eea4e63bb5791ff Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Tue, 31 Oct 2023 16:32:06 +0100 Subject: [PATCH 1/2] migrate UnorderedList to TypeScript --- .../{UnorderedList.js => UnorderedList.tsx} | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) rename src/components/{UnorderedList.js => UnorderedList.tsx} (64%) diff --git a/src/components/UnorderedList.js b/src/components/UnorderedList.tsx similarity index 64% rename from src/components/UnorderedList.js rename to src/components/UnorderedList.tsx index de8cb4abd7f8..a16f52545c3b 100644 --- a/src/components/UnorderedList.js +++ b/src/components/UnorderedList.tsx @@ -1,22 +1,17 @@ -import PropTypes from 'prop-types'; import React from 'react'; import {View} from 'react-native'; -import _ from 'underscore'; import styles from '@styles/styles'; import Text from './Text'; -const propTypes = { +type UnorderedListProps = { /** An array of strings to display as an unordered list */ - items: PropTypes.arrayOf(PropTypes.string), -}; -const defaultProps = { - items: [], + items: string[]; }; -function UnorderedList(props) { +function UnorderedList({items = []}: UnorderedListProps) { return ( <> - {_.map(props.items, (itemText) => ( + {items.map((itemText) => ( Date: Tue, 31 Oct 2023 17:16:03 +0100 Subject: [PATCH 2/2] minor fixes --- src/components/UnorderedList.tsx | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/components/UnorderedList.tsx b/src/components/UnorderedList.tsx index a16f52545c3b..6437a0114776 100644 --- a/src/components/UnorderedList.tsx +++ b/src/components/UnorderedList.tsx @@ -5,23 +5,19 @@ import Text from './Text'; type UnorderedListProps = { /** An array of strings to display as an unordered list */ - items: string[]; + items?: string[]; }; function UnorderedList({items = []}: UnorderedListProps) { - return ( - <> - {items.map((itemText) => ( - - {'\u2022'} - {itemText} - - ))} - - ); + return items.map((itemText) => ( + + {'\u2022'} + {itemText} + + )); } UnorderedList.displayName = 'UnorderedList';