-
Notifications
You must be signed in to change notification settings - Fork 0
Theme switcher refactor #29
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
base: master
Are you sure you want to change the base?
Changes from all commits
eafa545
4b8fd5e
3c204ed
6c64f92
296123a
93309c3
53614f9
9fb7f8b
bcdc987
695e702
8ef83cc
8a043be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,7 @@ import MaterialIcon from '@react-native-vector-icons/material-design-icons'; | |||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| import { List as PaperList, Divider as PaperDivider } from 'react-native-paper'; | ||||||||||||||||||||||||||||||||||||||
| import { ThemeColors } from '../../theme/types'; | ||||||||||||||||||||||||||||||||||||||
| import { ColorInstance } from 'color'; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| interface ListItemProps { | ||||||||||||||||||||||||||||||||||||||
| title: string; | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -126,12 +127,12 @@ const Icon = ({ icon, theme }: { icon: string; theme: ThemeColors }) => ( | |||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| interface ColorItemProps { | ||||||||||||||||||||||||||||||||||||||
| title: string; | ||||||||||||||||||||||||||||||||||||||
| description: string; | ||||||||||||||||||||||||||||||||||||||
| color: ColorInstance; | ||||||||||||||||||||||||||||||||||||||
| theme: ThemeColors; | ||||||||||||||||||||||||||||||||||||||
| onPress: () => void; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| const ColorItem = ({ title, description, theme, onPress }: ColorItemProps) => ( | ||||||||||||||||||||||||||||||||||||||
| const ColorItem = ({ title, color, theme, onPress }: ColorItemProps) => ( | ||||||||||||||||||||||||||||||||||||||
| <Pressable | ||||||||||||||||||||||||||||||||||||||
| style={styles.pressable} | ||||||||||||||||||||||||||||||||||||||
| android_ripple={{ color: theme.rippleColor }} | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -141,12 +142,14 @@ const ColorItem = ({ title, description, theme, onPress }: ColorItemProps) => ( | |||||||||||||||||||||||||||||||||||||
| <Text style={[{ color: theme.onSurface }, styles.fontSize16]}> | ||||||||||||||||||||||||||||||||||||||
| {title} | ||||||||||||||||||||||||||||||||||||||
| </Text> | ||||||||||||||||||||||||||||||||||||||
| <Text style={{ color: theme.onSurfaceVariant }}>{description}</Text> | ||||||||||||||||||||||||||||||||||||||
| <Text style={{ color: theme.onSurfaceVariant }}> | ||||||||||||||||||||||||||||||||||||||
| {color.rgb().toString().toUpperCase()} | ||||||||||||||||||||||||||||||||||||||
| </Text> | ||||||||||||||||||||||||||||||||||||||
| </View> | ||||||||||||||||||||||||||||||||||||||
| <View | ||||||||||||||||||||||||||||||||||||||
| style={[ | ||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||
| backgroundColor: description, | ||||||||||||||||||||||||||||||||||||||
| backgroundColor: color.hex(), | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| styles.descriptionView, | ||||||||||||||||||||||||||||||||||||||
| ]} | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
149
to
155
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add an outline to keep light swatches visible. At Line 152, very light colors can visually disappear against the background. Add a thin border so every swatch remains visible. 💡 Suggested patch <View
style={[
{
backgroundColor: color.hex(),
+ borderWidth: StyleSheet.hairlineWidth,
+ borderColor: theme.outlineVariant,
},
styles.descriptionView,
]}
/>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onResetleaves stale local state behind.textis initialized once from thecolorprop (Line 29) and the modal stays mounted across visibility toggles. After Reset the parent receivesundefined, but the localtext/errorare untouched — so the next time the modal opens the input still shows the previously-typed (possibly invalid) value and any prior error message remains. Reset should clear both.🛠️ Proposed fix
const onReset = () => { onSubmit(undefined); + setText(''); + setError(null); closeModal(); };📝 Committable suggestion
🤖 Prompt for AI Agents