chore: tweak the album art example

This commit is contained in:
Satyajit Sahoo
2020-01-29 23:41:04 +01:00
parent 0b4bf1dcc8
commit d0510d0220
32 changed files with 56 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 900 B

After

Width:  |  Height:  |  Size: 683 B

View File

@@ -2,23 +2,41 @@
import * as React from 'react';
import {
View,
Image,
Dimensions,
ScrollView,
StyleSheet,
ScrollViewProps,
Dimensions,
Platform,
} from 'react-native';
import { useScrollToTop } from '@react-navigation/native';
const COVERS = [
require('../../assets/album-art-1.jpg'),
require('../../assets/album-art-2.jpg'),
require('../../assets/album-art-3.jpg'),
require('../../assets/album-art-4.jpg'),
require('../../assets/album-art-5.jpg'),
require('../../assets/album-art-6.jpg'),
require('../../assets/album-art-7.jpg'),
require('../../assets/album-art-8.jpg'),
require('../../assets/album-art-01.jpg'),
require('../../assets/album-art-02.jpg'),
require('../../assets/album-art-03.jpg'),
require('../../assets/album-art-04.jpg'),
require('../../assets/album-art-05.jpg'),
require('../../assets/album-art-06.jpg'),
require('../../assets/album-art-07.jpg'),
require('../../assets/album-art-08.jpg'),
require('../../assets/album-art-09.jpg'),
require('../../assets/album-art-10.jpg'),
require('../../assets/album-art-11.jpg'),
require('../../assets/album-art-12.jpg'),
require('../../assets/album-art-13.jpg'),
require('../../assets/album-art-14.jpg'),
require('../../assets/album-art-15.jpg'),
require('../../assets/album-art-16.jpg'),
require('../../assets/album-art-17.jpg'),
require('../../assets/album-art-18.jpg'),
require('../../assets/album-art-19.jpg'),
require('../../assets/album-art-20.jpg'),
require('../../assets/album-art-21.jpg'),
require('../../assets/album-art-22.jpg'),
require('../../assets/album-art-23.jpg'),
require('../../assets/album-art-24.jpg'),
];
export default function Albums(props: Partial<ScrollViewProps>) {
@@ -27,34 +45,46 @@ export default function Albums(props: Partial<ScrollViewProps>) {
useScrollToTop(ref);
return (
<ScrollView
ref={ref}
style={styles.container}
contentContainerStyle={styles.content}
{...props}
>
<ScrollView ref={ref} contentContainerStyle={styles.content} {...props}>
{COVERS.map((source, i) => (
// eslint-disable-next-line react/no-array-index-key
<Image key={i} source={source} style={styles.cover} />
))}
{COVERS.map((source, i) => (
// eslint-disable-next-line react/no-array-index-key
<Image key={i + 'F'} source={source} style={styles.cover} />
<View key={i} style={styles.item}>
<Image source={source} style={styles.photo} />
</View>
))}
</ScrollView>
);
}
const styles = StyleSheet.create({
container: {
backgroundColor: '#000',
},
content: {
flexDirection: 'row',
flexWrap: 'wrap',
},
cover: {
width: '50%',
height: Dimensions.get('window').width / 2,
...Platform.select({
web: {
content: {
display: 'grid' as 'none',
gridTemplateColumns: 'repeat(auto-fill, minmax(150px, 1fr))',
},
item: {
width: '100%',
},
},
default: {
content: {
flexDirection: 'row',
flexWrap: 'wrap',
},
item: {
height: Dimensions.get('window').width / 2,
width: '50%',
},
},
}),
photo: {
flex: 1,
resizeMode: 'cover',
paddingTop: '100%',
},
});