Skip to content

Commit

Permalink
chore: Remove horizontal flatlist scroll in gallery.
Browse files Browse the repository at this point in the history
This is because TabbedHeaderPager has swipe gesture which cause horizontal flatlist scroll not working in android.
  • Loading branch information
yujune committed Apr 16, 2023
1 parent 63efca6 commit fc58895
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/screens/gallery/GalleryScreen.style.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {StyleSheet} from 'react-native';
import {AppSpacing} from '../../themes/theme';
import {windowWidth} from '../../utils/constants';

export const style = StyleSheet.create({
flatList: {
Expand All @@ -9,4 +10,11 @@ export const style = StyleSheet.create({
marginVertical: AppSpacing.small,
fontWeight: 'bold',
},
imageListContainer: {
flexDirection: 'row',
flexWrap: 'wrap',
},
imageContainer: {
width: windowWidth / 3.4,
},
});
18 changes: 10 additions & 8 deletions src/screens/gallery/GalleryScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ export const GalleryScreen: FC = () => {
<Text style={[theme.text?.bodyMedium, style.categoryTitle]}>
{item.name}
</Text>
<FlatList
horizontal
data={item.data}
keyExtractor={(_, index) => index.toString()}
renderItem={({item: pokemon}) => (
<PokemonListItem name={pokemon.name} customUrl={pokemon.url} />
)}
/>
<View style={style.imageListContainer}>
{item.data.map((pokemon, index) => (
<PokemonListItem
containerStyle={style.imageContainer}
key={pokemon.name + index.toString()}
name={pokemon.name}
customUrl={pokemon.url}
/>
))}
</View>
</View>
)}
/>
Expand Down

0 comments on commit fc58895

Please sign in to comment.