Skip to content

Commit

Permalink
Fix filter picker dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Leapward-Koex committed Aug 18, 2022
1 parent 45c5360 commit ee24a8b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
1 change: 1 addition & 0 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ declare global {

const theme = {
...DefaultTheme,
version: 3,
colors: {
...DefaultTheme.colors,
primary: '#cb2b78',
Expand Down
2 changes: 1 addition & 1 deletion components/ReleasesTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const ReleasesTab = () => {
);
const [showFilter, setShowFilter] = React.useState(ShowFilter.None);
const [searchTerm, setSearchTerm] = React.useState('');
const [refreshing, setRefreshing] = React.useState(false);
const [refreshing, setRefreshing] = React.useState(true);

const { watchedEpisodeStore, watchListStore } = useStore();

Expand Down
46 changes: 43 additions & 3 deletions components/releasePageComponents/ReleaseHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import * as React from 'react';
import { View, Keyboard, useWindowDimensions, StyleSheet } from 'react-native';
import { Appbar, Button, Dialog, Portal, Searchbar } from 'react-native-paper';
import {
View,
Keyboard,
useWindowDimensions,
StyleSheet,
Appearance,
} from 'react-native';
import {
Appbar,
Button,
Dialog,
Portal,
Searchbar,
useTheme,
} from 'react-native-paper';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import { RadioButton } from 'react-native-paper';
import AsyncStorage from '@react-native-async-storage/async-storage';
Expand Down Expand Up @@ -29,6 +42,7 @@ export const ReleaseTabHeader = ({
onFilterChanged,
}: ReleaseTabHeaderProps) => {
const { width } = useWindowDimensions();
const { colors } = useTheme();
const [searchQuery, setSearchQuery] = React.useState('');
const [filterPanelShown, setFilterPanelShown] = React.useState(false);

Expand All @@ -37,6 +51,18 @@ export const ReleaseTabHeader = ({
searchbar: { flexGrow: 1, width: width - 150 },
showFilterButton: { paddingTop: 5, width: 50 },
showFilterButtonContent: { flexDirection: 'row-reverse' },
backgroundStyle: {
backgroundColor:
Appearance.getColorScheme() !== 'light'
? colors.subsPleaseDark2
: colors.subsPleaseLight3,
},
font: {
color:
Appearance.getColorScheme() !== 'light'
? colors.darkText
: colors.lightText,
},
});

const onChangeText = (query: string) => {
Expand Down Expand Up @@ -70,6 +96,11 @@ export const ReleaseTabHeader = ({
return <></>;
};

const radioButtonStyle =
Appearance.getColorScheme() !== 'light'
? colors.darkText
: colors.lightText;

return (
<>
<Appbar.Header statusBarHeight={1}>
Expand All @@ -94,10 +125,11 @@ export const ReleaseTabHeader = ({
</Appbar.Header>
<Portal>
<Dialog
style={styles.backgroundStyle}
visible={filterPanelShown}
onDismiss={toggleFilterPanel}
>
<Dialog.Title>Filter</Dialog.Title>
<Dialog.Title style={styles.font}>Filter</Dialog.Title>
<Dialog.Content>
<RadioButton.Group
onValueChange={(value) => {
Expand All @@ -107,18 +139,26 @@ export const ReleaseTabHeader = ({
value={filter}
>
<RadioButton.Item
uncheckedColor={radioButtonStyle}
labelStyle={styles.font}
label="No filter"
value={ShowFilter.None}
/>
<RadioButton.Item
uncheckedColor={radioButtonStyle}
labelStyle={styles.font}
label="New"
value={ShowFilter.NewRelease}
/>
<RadioButton.Item
uncheckedColor={radioButtonStyle}
labelStyle={styles.font}
label="Watching shows"
value={ShowFilter.Watching}
/>
<RadioButton.Item
uncheckedColor={radioButtonStyle}
labelStyle={styles.font}
label="Downloaded shows"
value={ShowFilter.Downloaded}
/>
Expand Down

0 comments on commit ee24a8b

Please sign in to comment.