diff --git a/components/SquareEnumeratedWords.js b/components/SquareEnumeratedWords.tsx similarity index 73% rename from components/SquareEnumeratedWords.js rename to components/SquareEnumeratedWords.tsx index b3787c0fe..59588def4 100644 --- a/components/SquareEnumeratedWords.js +++ b/components/SquareEnumeratedWords.tsx @@ -1,16 +1,21 @@ import React from 'react'; - import { TouchableOpacity, Text, StyleSheet, View } from 'react-native'; -import PropTypes from 'prop-types'; import { useTheme } from './themes'; -export const SquareEnumeratedWordsContentAlign = Object.freeze({ left: 'flex-start', center: 'center', right: 'flex-end' }); -const SquareEnumeratedWords = props => { - const { - entries = ['Empty entries prop. Please provide an array of strings'], - appendNumber = true, - contentAlign = SquareEnumeratedWordsContentAlign.center, - } = props; +type ContentAlignType = 'flex-start' | 'center' | 'flex-end'; +export const SquareEnumeratedWordsContentAlign: Record = Object.freeze({ + left: 'flex-start', + center: 'center', + right: 'flex-end', +}); + +interface SquareEnumeratedWordsProps { + entries: string[]; + appendNumber: boolean; + contentAlign: ContentAlignType; +} + +const SquareEnumeratedWords: React.FC = ({ entries, appendNumber, contentAlign }) => { const { colors } = useTheme(); const stylesHook = StyleSheet.create({ entryTextContainer: { @@ -19,6 +24,9 @@ const SquareEnumeratedWords = props => { entryText: { color: colors.labelText, }, + container: { + justifyContent: contentAlign, + }, }); const renderSecret = () => { @@ -51,7 +59,7 @@ const SquareEnumeratedWords = props => { return component; }; - return {renderSecret()}; + return {renderSecret()}; }; const styles = StyleSheet.create({ @@ -73,10 +81,5 @@ const styles = StyleSheet.create({ flexWrap: 'wrap', }, }); -SquareEnumeratedWords.propTypes = { - entries: PropTypes.arrayOf(PropTypes.string), - contentAlign: PropTypes.string, - appendNumber: PropTypes.bool, -}; export default SquareEnumeratedWords;