Skip to content

Commit d2b0345

Browse files
committed
Fix Shimmer component
It looks like the shimmer component gradient doesn't render anymore after the react-native upgrade. It seems like this change will kick rendering of the gradients to after the dimensions of the shimmer is calculated, fixing the rendering issue.
1 parent 4400474 commit d2b0345

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export default [
203203
'src/components/progress-indicators/CancellableProcessingScene.tsx',
204204
'src/components/progress-indicators/FullScreenLoader.tsx',
205205
'src/components/progress-indicators/LoadingSplashScreen.tsx',
206-
'src/components/progress-indicators/Shimmer.tsx',
206+
207207
'src/components/progress-indicators/StepProgressBar.tsx',
208208
'src/components/rows/CoinRankRow.tsx',
209209
'src/components/rows/CryptoFiatAmountRow.tsx',

src/components/progress-indicators/Shimmer.tsx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface Props {
1717
isShown?: boolean
1818
}
1919

20-
export const Shimmer = (props: Props) => {
20+
export const Shimmer: React.FC<Props> = props => {
2121
const { isShown = true } = props
2222
const theme = useTheme()
2323
const styles = getStyles(theme)
@@ -58,18 +58,22 @@ export const Shimmer = (props: Props) => {
5858
<Animated.View
5959
style={[styles.gradientContainer, { width: shimmerWidth }, animStyle]}
6060
>
61-
<LinearGradient
62-
style={styles.gradient}
63-
start={{ x: 0, y: 0 }}
64-
end={{ x: 1, y: 1 }}
65-
colors={['rgba(0,0,0,0)', theme.shimmerBackgroundHighlight]}
66-
/>
67-
<LinearGradient
68-
style={styles.gradient}
69-
start={{ x: 1, y: 0 }}
70-
end={{ x: 0, y: 1 }}
71-
colors={['rgba(0,0,0,0)', theme.shimmerBackgroundHighlight]}
72-
/>
61+
{containerWidth > 0 ? (
62+
<>
63+
<LinearGradient
64+
style={styles.gradient}
65+
start={{ x: 0, y: 0 }}
66+
end={{ x: 1, y: 1 }}
67+
colors={['rgba(0,0,0,0)', theme.shimmerBackgroundHighlight]}
68+
/>
69+
<LinearGradient
70+
style={styles.gradient}
71+
start={{ x: 1, y: 0 }}
72+
end={{ x: 0, y: 1 }}
73+
colors={['rgba(0,0,0,0)', theme.shimmerBackgroundHighlight]}
74+
/>
75+
</>
76+
) : null}
7377
</Animated.View>
7478
</View>
7579
) : null

0 commit comments

Comments
 (0)