Remove the 'loading' placeholder from images as it degraded feed perf (#202)
* Remove the 'loading' placeholder from images as it degraded feed perf * Remove references
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB |
@@ -2,7 +2,6 @@ import React from 'react'
|
|||||||
import {StyleProp, StyleSheet, TouchableOpacity, ViewStyle} from 'react-native'
|
import {StyleProp, StyleSheet, TouchableOpacity, ViewStyle} from 'react-native'
|
||||||
import FastImage, {OnLoadEvent} from 'react-native-fast-image'
|
import FastImage, {OnLoadEvent} from 'react-native-fast-image'
|
||||||
import {DELAY_PRESS_IN} from './constants'
|
import {DELAY_PRESS_IN} from './constants'
|
||||||
import {LOADING} from '../../../lib/assets'
|
|
||||||
import {clamp} from '../../../../lib/numbers'
|
import {clamp} from '../../../../lib/numbers'
|
||||||
|
|
||||||
const MIN_ASPECT_RATIO = 0.33 // 1/3
|
const MIN_ASPECT_RATIO = 0.33 // 1/3
|
||||||
@@ -43,7 +42,6 @@ export function Image({
|
|||||||
<FastImage
|
<FastImage
|
||||||
style={[styles.image, {aspectRatio}]}
|
style={[styles.image, {aspectRatio}]}
|
||||||
source={{uri}}
|
source={{uri}}
|
||||||
defaultSource={LOADING}
|
|
||||||
onLoad={onLoad}
|
onLoad={onLoad}
|
||||||
/>
|
/>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import {
|
|||||||
ViewStyle,
|
ViewStyle,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import FastImage, {ImageStyle as FastImageStyle} from 'react-native-fast-image'
|
import FastImage, {ImageStyle as FastImageStyle} from 'react-native-fast-image'
|
||||||
import {LOADING} from '../../../lib/assets'
|
|
||||||
import {DELAY_PRESS_IN} from './constants'
|
import {DELAY_PRESS_IN} from './constants'
|
||||||
|
|
||||||
interface Dim {
|
interface Dim {
|
||||||
@@ -100,11 +99,7 @@ function ImageLayoutGridInner({
|
|||||||
onPress={() => onPress?.(0)}
|
onPress={() => onPress?.(0)}
|
||||||
onPressIn={() => onPressIn?.(0)}
|
onPressIn={() => onPressIn?.(0)}
|
||||||
onLongPress={() => onLongPress(0)}>
|
onLongPress={() => onLongPress(0)}>
|
||||||
<FastImage
|
<FastImage source={{uri: uris[0]}} style={size1} />
|
||||||
source={{uri: uris[0]}}
|
|
||||||
style={size1}
|
|
||||||
defaultSource={LOADING}
|
|
||||||
/>
|
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<View style={styles.wSpace} />
|
<View style={styles.wSpace} />
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
@@ -112,11 +107,7 @@ function ImageLayoutGridInner({
|
|||||||
onPress={() => onPress?.(1)}
|
onPress={() => onPress?.(1)}
|
||||||
onPressIn={() => onPressIn?.(1)}
|
onPressIn={() => onPressIn?.(1)}
|
||||||
onLongPress={() => onLongPress(1)}>
|
onLongPress={() => onLongPress(1)}>
|
||||||
<FastImage
|
<FastImage source={{uri: uris[1]}} style={size1} />
|
||||||
source={{uri: uris[1]}}
|
|
||||||
style={size1}
|
|
||||||
defaultSource={LOADING}
|
|
||||||
/>
|
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
@@ -129,11 +120,7 @@ function ImageLayoutGridInner({
|
|||||||
onPress={() => onPress?.(0)}
|
onPress={() => onPress?.(0)}
|
||||||
onPressIn={() => onPressIn?.(0)}
|
onPressIn={() => onPressIn?.(0)}
|
||||||
onLongPress={() => onLongPress(0)}>
|
onLongPress={() => onLongPress(0)}>
|
||||||
<FastImage
|
<FastImage source={{uri: uris[0]}} style={size2} />
|
||||||
source={{uri: uris[0]}}
|
|
||||||
style={size2}
|
|
||||||
defaultSource={LOADING}
|
|
||||||
/>
|
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<View style={styles.wSpace} />
|
<View style={styles.wSpace} />
|
||||||
<View>
|
<View>
|
||||||
@@ -142,11 +129,7 @@ function ImageLayoutGridInner({
|
|||||||
onPress={() => onPress?.(1)}
|
onPress={() => onPress?.(1)}
|
||||||
onPressIn={() => onPressIn?.(1)}
|
onPressIn={() => onPressIn?.(1)}
|
||||||
onLongPress={() => onLongPress(1)}>
|
onLongPress={() => onLongPress(1)}>
|
||||||
<FastImage
|
<FastImage source={{uri: uris[1]}} style={size1} />
|
||||||
source={{uri: uris[1]}}
|
|
||||||
style={size1}
|
|
||||||
defaultSource={LOADING}
|
|
||||||
/>
|
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<View style={styles.hSpace} />
|
<View style={styles.hSpace} />
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
@@ -154,11 +137,7 @@ function ImageLayoutGridInner({
|
|||||||
onPress={() => onPress?.(2)}
|
onPress={() => onPress?.(2)}
|
||||||
onPressIn={() => onPressIn?.(2)}
|
onPressIn={() => onPressIn?.(2)}
|
||||||
onLongPress={() => onLongPress(2)}>
|
onLongPress={() => onLongPress(2)}>
|
||||||
<FastImage
|
<FastImage source={{uri: uris[2]}} style={size1} />
|
||||||
source={{uri: uris[2]}}
|
|
||||||
style={size1}
|
|
||||||
defaultSource={LOADING}
|
|
||||||
/>
|
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
@@ -173,11 +152,7 @@ function ImageLayoutGridInner({
|
|||||||
onPress={() => onPress?.(0)}
|
onPress={() => onPress?.(0)}
|
||||||
onPressIn={() => onPressIn?.(0)}
|
onPressIn={() => onPressIn?.(0)}
|
||||||
onLongPress={() => onLongPress(0)}>
|
onLongPress={() => onLongPress(0)}>
|
||||||
<FastImage
|
<FastImage source={{uri: uris[0]}} style={size1} />
|
||||||
source={{uri: uris[0]}}
|
|
||||||
style={size1}
|
|
||||||
defaultSource={LOADING}
|
|
||||||
/>
|
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<View style={styles.hSpace} />
|
<View style={styles.hSpace} />
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
@@ -185,11 +160,7 @@ function ImageLayoutGridInner({
|
|||||||
onPress={() => onPress?.(2)}
|
onPress={() => onPress?.(2)}
|
||||||
onPressIn={() => onPressIn?.(2)}
|
onPressIn={() => onPressIn?.(2)}
|
||||||
onLongPress={() => onLongPress(2)}>
|
onLongPress={() => onLongPress(2)}>
|
||||||
<FastImage
|
<FastImage source={{uri: uris[2]}} style={size1} />
|
||||||
source={{uri: uris[2]}}
|
|
||||||
style={size1}
|
|
||||||
defaultSource={LOADING}
|
|
||||||
/>
|
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.wSpace} />
|
<View style={styles.wSpace} />
|
||||||
@@ -199,11 +170,7 @@ function ImageLayoutGridInner({
|
|||||||
onPress={() => onPress?.(1)}
|
onPress={() => onPress?.(1)}
|
||||||
onPressIn={() => onPressIn?.(1)}
|
onPressIn={() => onPressIn?.(1)}
|
||||||
onLongPress={() => onLongPress(1)}>
|
onLongPress={() => onLongPress(1)}>
|
||||||
<FastImage
|
<FastImage source={{uri: uris[1]}} style={size1} />
|
||||||
source={{uri: uris[1]}}
|
|
||||||
style={size1}
|
|
||||||
defaultSource={LOADING}
|
|
||||||
/>
|
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<View style={styles.hSpace} />
|
<View style={styles.hSpace} />
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
@@ -211,11 +178,7 @@ function ImageLayoutGridInner({
|
|||||||
onPress={() => onPress?.(3)}
|
onPress={() => onPress?.(3)}
|
||||||
onPressIn={() => onPressIn?.(3)}
|
onPressIn={() => onPressIn?.(3)}
|
||||||
onLongPress={() => onLongPress(3)}>
|
onLongPress={() => onLongPress(3)}>
|
||||||
<FastImage
|
<FastImage source={{uri: uris[3]}} style={size1} />
|
||||||
source={{uri: uris[3]}}
|
|
||||||
style={size1}
|
|
||||||
defaultSource={LOADING}
|
|
||||||
/>
|
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -3,4 +3,3 @@ import {ImageRequireSource} from 'react-native'
|
|||||||
export const DEF_AVATAR: ImageRequireSource = require('../../../public/img/default-avatar.jpg')
|
export const DEF_AVATAR: ImageRequireSource = require('../../../public/img/default-avatar.jpg')
|
||||||
export const TABS_EXPLAINER: ImageRequireSource = require('../../../public/img/tabs-explainer.jpg')
|
export const TABS_EXPLAINER: ImageRequireSource = require('../../../public/img/tabs-explainer.jpg')
|
||||||
export const CLOUD_SPLASH: ImageRequireSource = require('../../../public/img/cloud-splash.png')
|
export const CLOUD_SPLASH: ImageRequireSource = require('../../../public/img/cloud-splash.png')
|
||||||
export const LOADING: ImageRequireSource = require('../../../public/img/loading.png')
|
|
||||||
|
|||||||
@@ -8,5 +8,3 @@ export const TABS_EXPLAINER: ImageRequireSource = {
|
|||||||
}
|
}
|
||||||
// @ts-ignore we need to pretend -prf
|
// @ts-ignore we need to pretend -prf
|
||||||
export const CLOUD_SPLASH: ImageRequireSource = {uri: '/img/cloud-splash.png'}
|
export const CLOUD_SPLASH: ImageRequireSource = {uri: '/img/cloud-splash.png'}
|
||||||
// @ts-ignore we need to pretend -prf
|
|
||||||
export const LOADING: ImageRequireSource = {uri: '/img/loading.png'}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user