diff --git a/src/components/RadioButton.js b/src/components/RadioButton.tsx similarity index 62% rename from src/components/RadioButton.js rename to src/components/RadioButton.tsx index 9a7b6d38095a..b5e0467d3f00 100644 --- a/src/components/RadioButton.js +++ b/src/components/RadioButton.tsx @@ -1,4 +1,3 @@ -import PropTypes from 'prop-types'; import React from 'react'; import {View} from 'react-native'; import useTheme from '@styles/themes/useTheme'; @@ -8,42 +7,38 @@ import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; import PressableWithFeedback from './Pressable/PressableWithFeedback'; -const propTypes = { +type RadioButtonProps = { /** Whether radioButton is checked */ - isChecked: PropTypes.bool.isRequired, + isChecked: boolean; /** A function that is called when the box/label is pressed */ - onPress: PropTypes.func.isRequired, + onPress: () => void; /** Specifies the accessibility label for the radio button */ - accessibilityLabel: PropTypes.string.isRequired, + accessibilityLabel: string; /** Should the input be styled for errors */ - hasError: PropTypes.bool, + hasError?: boolean; /** Should the input be disabled */ - disabled: PropTypes.bool, + disabled?: boolean; }; -const defaultProps = { - hasError: false, - disabled: false, -}; - -function RadioButton(props) { +function RadioButton({isChecked, onPress, accessibilityLabel, hasError = false, disabled = false}: RadioButtonProps) { const theme = useTheme(); const styles = useThemeStyles(); + return ( - - {props.isChecked && ( + + {isChecked && (