Skip to content

Commit

Permalink
Fix filtering styling
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapawar1 committed Sep 30, 2024
1 parent 249da7a commit 512d517
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 24 deletions.
11 changes: 1 addition & 10 deletions src/app/(tabs)/search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ function SearchScreen() {
}}
/>

{((search && searchResults.length > 0) || showGenreCarousals) && (
{(search || showGenreCarousals) && (
<ScrollView
horizontal={true}
showsHorizontalScrollIndicator={false}
Expand Down Expand Up @@ -441,15 +441,6 @@ function SearchScreen() {
</ScrollView>
)}

{/* {search && ( */}
{/* <View style={styles.default}> */}
{/* <Button */}
{/* title="Show Filter Modal" */}
{/* onPress={() => setFilterVisible(true)} */}
{/* /> */}
{/* </View> */}
{/* )} */}

{showRecents &&
(search && searchResults.length > 0 ? (
<View style={styles.resultCounter}>
Expand Down
10 changes: 5 additions & 5 deletions src/app/(tabs)/search/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ const styles = StyleSheet.create({
textDecorationLine: 'underline',
},
emptySearch: {
display: 'flex',
flexDirection: 'column',
textAlign: 'center',
alignItems: 'center',
marginTop: '60%',
// display: 'flex',
// flexDirection: 'column',
// textAlign: 'center',
// alignItems: 'center',
},
cancelButton: {
color: colors.grey,
Expand All @@ -103,6 +102,7 @@ const styles = StyleSheet.create({
color: '#797979',
},
dropdownContainer: {
zIndex: 1,
marginLeft: 10,
marginTop: 13,
marginBottom: 30,
Expand Down
6 changes: 5 additions & 1 deletion src/components/FilterDropdown/FilterDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ function FilterSingleDropdown({
style={styles.dropdown}
value={value}
placeholderStyle={[globalStyles.body1, styles.placeholderStyle]}
selectedTextStyle={globalStyles.body1}
selectedTextStyle={[
globalStyles.body1,
styles.placeholderStyle,
{ color: colors.black },
]}
inputSearchStyle={globalStyles.body1}
itemTextStyle={globalStyles.body1}
dropdownPosition="bottom"
Expand Down
1 change: 1 addition & 0 deletions src/components/FilterDropdown/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import colors from '../../styles/colors';

const styles = StyleSheet.create({
dropdown: {
zIndex: 1,
borderColor: colors.darkGrey,
flexGrow: 0,
flexShrink: 0,
Expand Down
17 changes: 10 additions & 7 deletions src/components/FilterModal/FilterModal.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { BottomSheet, CheckBox } from '@rneui/themed';
import { useCallback, useState } from 'react';
import { View, Text, ScrollView, Pressable } from 'react-native';
import { BottomSheet } from '@rneui/themed';
import { useCallback } from 'react';
import { View, Text, Pressable } from 'react-native';
import { FlatList } from 'react-native-gesture-handler';
import { SafeAreaProvider } from 'react-native-safe-area-context';

import ChildFilter from './ChildFilter';
import ParentFilter from './ParentFilter';
import styles from './styles';
import Icon from '../../../assets/icons';
import { TagFilter, useFilter } from '../../utils/FilterContext';
import {
useFilter,
type ParentFilter as ParentFilterType,
} from '../../utils/FilterContext';
import ParentFilter from './ParentFilter';

type FilterModalProps = {
isVisible: boolean;
Expand Down Expand Up @@ -59,7 +62,7 @@ function FilterModal({ isVisible, setIsVisible, title }: FilterModalProps) {
<FlatList
data={Array.from(filters)}
renderItem={({ item }) => {
const [_, parentFilter] = item;
const [_, parentFilter] = item as [number, ParentFilterType];
return (
<>
<ParentFilter
Expand All @@ -71,7 +74,7 @@ function FilterModal({ isVisible, setIsVisible, title }: FilterModalProps) {

<FlatList
data={parentFilter.children}
renderItem={({ item }) => {
renderItem={({ item }: { item: any }) => {
return (
<ChildFilter
id={item.id}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/FilterContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type TagFilter = {
parent: number | null;
};

type ParentFilter = { children: TagFilter[] } & TagFilter;
export type ParentFilter = { children: TagFilter[] } & TagFilter;

export interface FilterState {
filters: Map<number, ParentFilter>;
Expand Down

0 comments on commit 512d517

Please sign in to comment.