import React from 'react' import { Pressable, StyleSheet, Text, View } from 'react-native' import { Feather } from '@expo/vector-icons' import { useTheme } from '@utils/styles/ThemeManager' import { ColorDefinitions } from '@utils/styles/themes' import { StyleConstants } from '@utils/styles/constants' export interface Props { iconFront?: any iconFrontColor?: ColorDefinitions title: string content?: string iconBack?: 'chevron-right' | 'check' iconBackColor?: ColorDefinitions onPress?: () => void } const Core: React.FC = ({ iconFront, iconFrontColor, title, content, iconBack, iconBackColor }) => { const { theme } = useTheme() iconFrontColor = iconFrontColor || 'primary' iconBackColor = iconBackColor || 'secondary' return ( {iconFront && ( )} {title} {(content || iconBack) && ( {content && ( {content} )} {iconBack && ( )} )} ) } const MenuRow: React.FC = ({ ...props }) => { const { theme } = useTheme() return props.onPress ? ( ) : ( ) } const styles = StyleSheet.create({ base: { height: 50, borderBottomWidth: 1 }, core: { flex: 1, flexDirection: 'row', paddingLeft: StyleConstants.Spacing.Global.PagePadding, paddingRight: StyleConstants.Spacing.Global.PagePadding }, front: { flex: 1, flexBasis: '70%', flexDirection: 'row', alignItems: 'center' }, back: { flex: 1, flexBasis: '30%', flexDirection: 'row', justifyContent: 'flex-end', alignItems: 'center' }, iconFront: { marginRight: 8 }, text: { flex: 1, fontSize: StyleConstants.Font.Size.M }, content: { fontSize: StyleConstants.Font.Size.M }, iconBack: { marginLeft: 8 } }) export default React.memo(MenuRow, (prev, next) => { let skipUpdate = true skipUpdate = prev.content === next.content return skipUpdate })