1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Poll working

But did not re-render
This commit is contained in:
Zhiyuan Zheng
2020-12-03 01:28:56 +01:00
parent 8986680c6d
commit 7d7c907fa3
35 changed files with 1125 additions and 766 deletions

View File

@ -34,7 +34,7 @@ const styles = StyleSheet.create({
paddingRight: StyleConstants.Spacing.S
},
text: {
fontSize: StyleConstants.Font.Size.L
fontSize: StyleConstants.Font.Size.M
}
})

View File

@ -6,6 +6,7 @@ import { useTheme } from 'src/utils/styles/ThemeManager'
import { StyleConstants } from 'src/utils/styles/constants'
type PropsBase = {
disabled?: boolean
onPress: () => void
}
@ -20,6 +21,7 @@ export interface PropsIcon extends PropsBase {
}
const HeaderRight: React.FC<PropsText | PropsIcon> = ({
disabled,
onPress,
text,
icon
@ -27,12 +29,21 @@ const HeaderRight: React.FC<PropsText | PropsIcon> = ({
const { theme } = useTheme()
return (
<Pressable onPress={onPress} style={styles.base}>
{text && <Text style={[styles.text, { color: theme.primary }]}>{text}</Text>}
<Pressable {...(!disabled && { onPress })} style={styles.base}>
{text && (
<Text
style={[
styles.text,
{ color: disabled ? theme.secondary : theme.primary }
]}
>
{text}
</Text>
)}
{icon && (
<Feather
name={icon}
color={theme.primary}
color={disabled ? theme.secondary : theme.primary}
size={StyleConstants.Font.Size.L}
/>
)}
@ -45,7 +56,7 @@ const styles = StyleSheet.create({
paddingLeft: StyleConstants.Spacing.S
},
text: {
fontSize: StyleConstants.Font.Size.L
fontSize: StyleConstants.Font.Size.M
}
})