Work around a startup stall caused by expo-image on low-end Android (#1801)
* Use plain RN image for startup-blocking UI * Add commentszio/stable
parent
5e2025e60a
commit
8747c215b1
|
@ -1,5 +1,5 @@
|
||||||
import React, {useMemo} from 'react'
|
import React, {useMemo} from 'react'
|
||||||
import {StyleSheet, View} from 'react-native'
|
import {Image, StyleSheet, View} from 'react-native'
|
||||||
import Svg, {Circle, Rect, Path} from 'react-native-svg'
|
import Svg, {Circle, Rect, Path} from 'react-native-svg'
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
import {HighPriorityImage} from 'view/com/util/images/Image'
|
import {HighPriorityImage} from 'view/com/util/images/Image'
|
||||||
|
@ -27,6 +27,7 @@ interface BaseUserAvatarProps {
|
||||||
|
|
||||||
interface UserAvatarProps extends BaseUserAvatarProps {
|
interface UserAvatarProps extends BaseUserAvatarProps {
|
||||||
moderation?: ModerationUI
|
moderation?: ModerationUI
|
||||||
|
usePlainRNImage?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EditableUserAvatarProps extends BaseUserAvatarProps {
|
interface EditableUserAvatarProps extends BaseUserAvatarProps {
|
||||||
|
@ -110,6 +111,7 @@ export function UserAvatar({
|
||||||
size,
|
size,
|
||||||
avatar,
|
avatar,
|
||||||
moderation,
|
moderation,
|
||||||
|
usePlainRNImage = false,
|
||||||
}: UserAvatarProps) {
|
}: UserAvatarProps) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
|
|
||||||
|
@ -146,6 +148,16 @@ export function UserAvatar({
|
||||||
return avatar &&
|
return avatar &&
|
||||||
!((moderation?.blur && isAndroid) /* android crashes with blur */) ? (
|
!((moderation?.blur && isAndroid) /* android crashes with blur */) ? (
|
||||||
<View style={{width: size, height: size}}>
|
<View style={{width: size, height: size}}>
|
||||||
|
{usePlainRNImage ? (
|
||||||
|
<Image
|
||||||
|
accessibilityIgnoresInvertColors
|
||||||
|
testID="userAvatarImage"
|
||||||
|
style={aviStyle}
|
||||||
|
resizeMode="cover"
|
||||||
|
source={{uri: avatar}}
|
||||||
|
blurRadius={moderation?.blur ? BLUR_AMOUNT : 0}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
<HighPriorityImage
|
<HighPriorityImage
|
||||||
testID="userAvatarImage"
|
testID="userAvatarImage"
|
||||||
style={aviStyle}
|
style={aviStyle}
|
||||||
|
@ -153,6 +165,7 @@ export function UserAvatar({
|
||||||
source={{uri: avatar}}
|
source={{uri: avatar}}
|
||||||
blurRadius={moderation?.blur ? BLUR_AMOUNT : 0}
|
blurRadius={moderation?.blur ? BLUR_AMOUNT : 0}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
{alert}
|
{alert}
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
|
|
|
@ -158,7 +158,12 @@ export const DrawerContent = observer(function DrawerContentImpl() {
|
||||||
accessibilityLabel="Profile"
|
accessibilityLabel="Profile"
|
||||||
accessibilityHint="Navigates to your profile"
|
accessibilityHint="Navigates to your profile"
|
||||||
onPress={onPressProfile}>
|
onPress={onPressProfile}>
|
||||||
<UserAvatar size={80} avatar={store.me.avatar} />
|
<UserAvatar
|
||||||
|
size={80}
|
||||||
|
avatar={store.me.avatar}
|
||||||
|
// See https://github.com/bluesky-social/social-app/pull/1801:
|
||||||
|
usePlainRNImage={true}
|
||||||
|
/>
|
||||||
<Text
|
<Text
|
||||||
type="title-lg"
|
type="title-lg"
|
||||||
style={[pal.text, s.bold, styles.profileCardDisplayName]}
|
style={[pal.text, s.bold, styles.profileCardDisplayName]}
|
||||||
|
|
|
@ -192,11 +192,21 @@ export const BottomBar = observer(function BottomBarImpl({
|
||||||
styles.onProfile,
|
styles.onProfile,
|
||||||
{borderColor: pal.text.color},
|
{borderColor: pal.text.color},
|
||||||
]}>
|
]}>
|
||||||
<UserAvatar avatar={store.me.avatar} size={27} />
|
<UserAvatar
|
||||||
|
avatar={store.me.avatar}
|
||||||
|
size={27}
|
||||||
|
// See https://github.com/bluesky-social/social-app/pull/1801:
|
||||||
|
usePlainRNImage={true}
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
<View style={[styles.ctrlIcon, pal.text, styles.profileIcon]}>
|
<View style={[styles.ctrlIcon, pal.text, styles.profileIcon]}>
|
||||||
<UserAvatar avatar={store.me.avatar} size={28} />
|
<UserAvatar
|
||||||
|
avatar={store.me.avatar}
|
||||||
|
size={28}
|
||||||
|
// See https://github.com/bluesky-social/social-app/pull/1801:
|
||||||
|
usePlainRNImage={true}
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
Loading…
Reference in New Issue