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 'SelectCircle.js' component to TypeScript #30077

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
40 changes: 0 additions & 40 deletions src/components/SelectCircle.js

This file was deleted.

29 changes: 29 additions & 0 deletions src/components/SelectCircle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react';
import {View} from 'react-native';
import globalStyles from '../styles/styles';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import themeColors from '../styles/themes/default';

type SelectCircleProps = {
/** Should we show the checkmark inside the circle */
isChecked: boolean;

/** Additional styles to pass to SelectCircle */
styles: Array<Record<string, unknown>>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use more accurate type here, ViewStyle[]?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OR let's do it the same as in this PR

};

function SelectCircle({isChecked = false, styles = []}: SelectCircleProps) {
return (
<View style={[globalStyles.selectCircle, globalStyles.alignSelfCenter, ...styles]}>
{isChecked && (
<Icon
src={Expensicons.Checkmark}
fill={themeColors.iconSuccessFill}
/>
)}
</View>
);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should always define displayName:

Suggested change
SelectCircle.displayName = 'SelectCircle';

export default SelectCircle;