faster-image
faster-image copied to clipboard
showActivityIndicator prop not removing the activity indicator.
Summary
Activity indicates are being displayed during the load phase regardless of showActivityIndicator state. We set the value to false globally for our app as we have our own loading visual but I still manage to see the activity spinner very frequently on IOS.
import React, { useState } from 'react';
import { FasterImageView } from '@candlefinance/faster-image';
import { View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
import { ImageOptions } from '@candlefinance/faster-image/src';
import { SkeletonLoading } from '@/src/components/SkeletonLoader';
export type PropTypes = {
source: ImageOptions;
style?: StyleProp<ViewStyle>;
};
export const RemoteImage = ({ source, style }: PropTypes) => {
const [loading, setLoading] = useState(true);
return (
<View style={[styles.container, style]}>
<FasterImageView
source={{
showActivityIndicator: false,
transitionDuration: 0.4,
resizeMode: 'cover',
cachePolicy: 'memoryAndDisc',
...source,
}}
onSuccess={() => setLoading(false)}
style={styles.image}
/>
{loading && <SkeletonLoading style={styles.loader} />}
</View>
);
};
const styles = StyleSheet.create({
container: {
position: 'relative',
overflow: 'hidden',
},
image: {
width: '100%',
height: '100%',
},
loader: {
...StyleSheet.absoluteFillObject,
width: '100%',
height: '100%',
},
});