Add image caching layer

This commit is contained in:
Lei Nelissen
2020-06-20 22:49:51 +02:00
parent 7aceac79c5
commit 91476ed5b6
10 changed files with 50 additions and 9 deletions

View File

@@ -39,7 +39,7 @@ export default class App extends Component<State> {
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistedStore}>
<PersistGate loading={null} persistor={persistedStore}>
<NavigationContainer>
<Routes />
</NavigationContainer>

View File

@@ -5,6 +5,7 @@ import { Text, ScrollView, Dimensions, Button, TouchableOpacity, RefreshControl
import { generateTrack, useGetImage } from '../../../utility/JellyfinApi';
import styled from 'styled-components/native';
import { useRoute, RouteProp } from '@react-navigation/native';
import FastImage from 'react-native-fast-image';
import { useDispatch } from 'react-redux';
import { useTypedSelector } from '../../../store';
import { fetchTracksByAlbum } from '../../../store/music/actions';
@@ -13,7 +14,7 @@ type Route = RouteProp<StackParams, 'Album'>;
const Screen = Dimensions.get('screen');
const AlbumImage = styled.Image`
const AlbumImage = styled(FastImage)`
border-radius: 10px;
width: ${Screen.width * 0.6}px;
height: ${Screen.width * 0.6}px;

View File

@@ -8,6 +8,7 @@ import { useDispatch } from 'react-redux';
import { useTypedSelector } from '../../../store';
import { fetchAllAlbums } from '../../../store/music/actions';
import { useNavigation } from '@react-navigation/native';
import FastImage from 'react-native-fast-image';
const Screen = Dimensions.get('screen');
@@ -24,7 +25,7 @@ const AlbumItem = styled.View`
padding: 10px;
`;
const AlbumImage = styled.Image`
const AlbumImage = styled(FastImage)`
border-radius: 10px;
width: ${Screen.width / 2 - 40}px;
height: ${Screen.width / 2 - 40}px;

View File

@@ -1,11 +1,12 @@
import React from 'react';
import { Text, Dimensions, Image, View } from 'react-native';
import { Text, Dimensions, View } from 'react-native';
import useCurrentTrack from '../../../utility/useCurrentTrack';
import styled from 'styled-components/native';
import FastImage from 'react-native-fast-image';
const Screen = Dimensions.get('screen');
const Artwork = styled.Image`
const Artwork = styled(FastImage)`
border-radius: 10px;
background-color: #fbfbfb;
width: ${Screen.width * 0.8}px;