[IMPROVE] - migrate directoryItem presentation layer

This commit is contained in:
AlexAlexandre 2021-07-29 12:45:32 -03:00
parent c6e7826500
commit 3f5f309643
3 changed files with 22 additions and 21 deletions

View File

@ -225,6 +225,7 @@ class ModalParser extends UiKitParserModal {
const { theme } = useContext(ThemeContext); const { theme } = useContext(ThemeContext);
const { multiline, actionId, placeholder } = element; const { multiline, actionId, placeholder } = element;
return ( return (
// @ts-ignore
<TextInput <TextInput
id={actionId} id={actionId}
placeholder={plainText(placeholder)} placeholder={plainText(placeholder)}

View File

@ -10,7 +10,26 @@ import { themes } from '../../constants/colors';
export { ROW_HEIGHT }; export { ROW_HEIGHT };
const DirectoryItemLabel = React.memo(({ text, theme }) => { type TDirectoryItemLabel = {
text: string;
theme: string;
}
interface IDirectoryItem {
title: string;
description: string;
avatar: string;
type: string;
onPress(): void;
testID: string;
style: any;
rightLabel: string;
rid: string;
theme: string;
teamMain: boolean;
}
const DirectoryItemLabel = React.memo(({ text, theme }: TDirectoryItemLabel) => {
if (!text) { if (!text) {
return null; return null;
} }
@ -19,7 +38,7 @@ const DirectoryItemLabel = React.memo(({ text, theme }) => {
const DirectoryItem = ({ const DirectoryItem = ({
title, description, avatar, onPress, testID, style, rightLabel, type, rid, theme, teamMain title, description, avatar, onPress, testID, style, rightLabel, type, rid, theme, teamMain
}) => ( }: IDirectoryItem) => (
<Touch <Touch
onPress={onPress} onPress={onPress}
style={{ backgroundColor: themes[theme].backgroundColor }} style={{ backgroundColor: themes[theme].backgroundColor }}
@ -46,23 +65,4 @@ const DirectoryItem = ({
</Touch> </Touch>
); );
DirectoryItem.propTypes = {
title: PropTypes.string.isRequired,
description: PropTypes.string,
avatar: PropTypes.string,
type: PropTypes.string,
onPress: PropTypes.func.isRequired,
testID: PropTypes.string.isRequired,
style: PropTypes.any,
rightLabel: PropTypes.string,
rid: PropTypes.string,
theme: PropTypes.string,
teamMain: PropTypes.bool
};
DirectoryItemLabel.propTypes = {
text: PropTypes.string,
theme: PropTypes.string
};
export default DirectoryItem; export default DirectoryItem;