Skip to content

Commit f84785d

Browse files
authored
Merge pull request #52481 from software-mansion-labs/@szymczak/fix-disappearing-bg
2 parents 3611198 + cb929cb commit f84785d

11 files changed

+47
-33
lines changed

ios/Podfile.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -2661,7 +2661,7 @@ PODS:
26612661
- RNSound/Core (= 0.11.2)
26622662
- RNSound/Core (0.11.2):
26632663
- React-Core
2664-
- RNSVG (15.6.0):
2664+
- RNSVG (15.9.0):
26652665
- DoubleConversion
26662666
- glog
26672667
- hermes-engine
@@ -2681,9 +2681,9 @@ PODS:
26812681
- ReactCodegen
26822682
- ReactCommon/turbomodule/bridging
26832683
- ReactCommon/turbomodule/core
2684-
- RNSVG/common (= 15.6.0)
2684+
- RNSVG/common (= 15.9.0)
26852685
- Yoga
2686-
- RNSVG/common (15.6.0):
2686+
- RNSVG/common (15.9.0):
26872687
- DoubleConversion
26882688
- glog
26892689
- hermes-engine
@@ -3295,7 +3295,7 @@ SPEC CHECKSUMS:
32953295
RNScreens: de6e57426ba0e6cbc3fb5b4f496e7f08cb2773c2
32963296
RNShare: bd4fe9b95d1ee89a200778cc0753ebe650154bb0
32973297
RNSound: 6c156f925295bdc83e8e422e7d8b38d33bc71852
3298-
RNSVG: 1079f96b39a35753d481a20e30603fd6fc4f6fa9
3298+
RNSVG: b2fbe96b2bb3887752f8abc1f495953847e90384
32993299
SDWebImage: 066c47b573f408f18caa467d71deace7c0f8280d
33003300
SDWebImageAVIFCoder: 00310d246aab3232ce77f1d8f0076f8c4b021d90
33013301
SDWebImageSVGCoder: 15a300a97ec1c8ac958f009c02220ac0402e936c

package-lock.json

+5-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
"react-native-screens": "3.34.0",
169169
"react-native-share": "11.0.2",
170170
"react-native-sound": "^0.11.2",
171-
"react-native-svg": "15.6.0",
171+
"react-native-svg": "15.9.0",
172172
"react-native-tab-view": "^3.5.2",
173173
"react-native-url-polyfill": "^2.0.0",
174174
"react-native-view-shot": "3.8.0",

src/components/OptionsListSkeletonView.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function OptionsListSkeletonView({shouldAnimate = true, shouldStyleAsTable = fal
2828
return (
2929
<ItemListSkeletonView
3030
shouldAnimate={shouldAnimate}
31-
itemViewStyle={shouldStyleAsTable && [styles.highlightBG, styles.mb2, styles.mh5, styles.br2]}
31+
itemViewStyle={shouldStyleAsTable && [styles.highlightBG, styles.mb2, styles.ml5, styles.br2]}
3232
gradientOpacityEnabled={gradientOpacityEnabled}
3333
renderSkeletonItem={({itemIndex}) => {
3434
const lineWidth = getLinedWidth(itemIndex);
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
import React from 'react';
22
import SkeletonViewContentLoader from 'react-content-loader/native';
3+
import {StyleSheet} from 'react-native';
34
import type SkeletonViewContentLoaderProps from './types';
45

5-
function ContentLoader(props: SkeletonViewContentLoaderProps) {
6-
// eslint-disable-next-line react/jsx-props-no-spreading
7-
return <SkeletonViewContentLoader {...props} />;
6+
function ContentLoader({style, ...props}: SkeletonViewContentLoaderProps) {
7+
return (
8+
<SkeletonViewContentLoader
9+
// eslint-disable-next-line react/jsx-props-no-spreading
10+
{...props}
11+
// Using StyleSheet.flatten() because SkeletonViewContentLoader is not able to handle array style notation(eg. style={[style1, style2]}) of style prop
12+
style={StyleSheet.flatten(style)}
13+
/>
14+
);
815
}
916

1017
export default ContentLoader;
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
import React from 'react';
2+
// eslint-disable-next-line no-restricted-imports
3+
import type {CSSProperties} from 'react';
24
import SkeletonViewContentLoader from 'react-content-loader';
5+
import {StyleSheet} from 'react-native';
36
import type SkeletonViewContentLoaderProps from './types';
47

5-
function ContentLoader(props: SkeletonViewContentLoaderProps) {
6-
// eslint-disable-next-line react/jsx-props-no-spreading
7-
return <SkeletonViewContentLoader {...props} />;
8+
function ContentLoader({style, ...props}: SkeletonViewContentLoaderProps) {
9+
return (
10+
<SkeletonViewContentLoader
11+
// eslint-disable-next-line react/jsx-props-no-spreading
12+
{...props}
13+
// Using StyleSheet.flatten() because SkeletonViewContentLoader is not able to handle array style notation(eg. style={[style1, style2]}) of style prop
14+
style={StyleSheet.flatten(style) as CSSProperties}
15+
/>
16+
);
817
}
918

1019
export default ContentLoader;
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type {IContentLoaderProps} from 'react-content-loader';
22
import type {IContentLoaderProps as NativeIContentLoaderProps} from 'react-content-loader/native';
33

4-
type SkeletonViewContentLoaderProps = IContentLoaderProps & NativeIContentLoaderProps;
4+
type SkeletonViewContentLoaderProps = Omit<IContentLoaderProps, 'style'> & NativeIContentLoaderProps;
55

66
export default SkeletonViewContentLoaderProps;

src/components/Skeletons/CardRowSkeleton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function CardRowSkeleton({shouldAnimate = true, fixedNumItems, gradientOpacityEn
3131
shouldAnimate={shouldAnimate}
3232
fixedNumItems={fixedNumItems}
3333
gradientOpacityEnabled={gradientOpacityEnabled}
34-
itemViewStyle={[styles.highlightBG, styles.mb3, styles.br3, styles.mh5]}
34+
itemViewStyle={[styles.highlightBG, styles.mb3, styles.br3, styles.ml5]}
3535
renderSkeletonItem={() => (
3636
<>
3737
<Circle

src/components/Skeletons/ItemListSkeletonView.tsx

+9-12
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,24 @@ function ItemListSkeletonView({
6363
for (let i = 0; i < numItems; i++) {
6464
const opacity = gradientOpacityEnabled ? 1 - i / (numItems - 1) : 1;
6565
items.push(
66-
<View
66+
<SkeletonViewContentLoader
6767
key={`skeletonContainer${i}`}
68-
style={[themeStyles.mr5, itemViewStyle, {opacity}]}
68+
animate={shouldAnimate}
69+
height={itemViewHeight}
70+
backgroundColor={theme.skeletonLHNIn}
71+
foregroundColor={theme.skeletonLHNOut}
72+
style={[themeStyles.mr5, itemViewStyle, {opacity}, {minHeight: itemViewHeight}]}
6973
>
70-
<SkeletonViewContentLoader
71-
animate={shouldAnimate}
72-
height={itemViewHeight}
73-
backgroundColor={theme.skeletonLHNIn}
74-
foregroundColor={theme.skeletonLHNOut}
75-
>
76-
{renderSkeletonItem({itemIndex: i})}
77-
</SkeletonViewContentLoader>
78-
</View>,
74+
{renderSkeletonItem({itemIndex: i})}
75+
</SkeletonViewContentLoader>,
7976
);
8077
}
8178
return items;
8279
}, [numItems, shouldAnimate, theme, themeStyles, renderSkeletonItem, gradientOpacityEnabled, itemViewHeight, itemViewStyle]);
8380

8481
return (
8582
<View
86-
style={[themeStyles.flex1, themeStyles.overflowHidden]}
83+
style={[themeStyles.flex1]}
8784
onLayout={handleLayout}
8885
>
8986
{skeletonViewItems}

src/components/Skeletons/SearchRowSkeleton.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function SearchRowSkeleton({shouldAnimate = true, fixedNumItems, gradientOpacity
4242
<View style={[styles.flex1, containerStyle]}>
4343
<ItemListSkeletonView
4444
itemViewHeight={CONST.SEARCH_SKELETON_VIEW_ITEM_HEIGHT}
45-
itemViewStyle={[styles.highlightBG, styles.mb2, styles.br3, styles.mh5]}
45+
itemViewStyle={[styles.highlightBG, styles.mb2, styles.br3, styles.ml5]}
4646
gradientOpacityEnabled={gradientOpacityEnabled}
4747
shouldAnimate={shouldAnimate}
4848
fixedNumItems={fixedNumItems}
@@ -126,7 +126,7 @@ function SearchRowSkeleton({shouldAnimate = true, fixedNumItems, gradientOpacity
126126
shouldAnimate={shouldAnimate}
127127
fixedNumItems={fixedNumItems}
128128
gradientOpacityEnabled={gradientOpacityEnabled}
129-
itemViewStyle={[styles.highlightBG, styles.mb2, styles.br3, styles.mh5]}
129+
itemViewStyle={[styles.highlightBG, styles.mb2, styles.br3, styles.ml5]}
130130
renderSkeletonItem={() => (
131131
<>
132132
<Rect

src/components/Skeletons/TableRowSkeleton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function TableListItemSkeleton({shouldAnimate = true, fixedNumItems, gradientOpa
2121
shouldAnimate={shouldAnimate}
2222
fixedNumItems={fixedNumItems}
2323
gradientOpacityEnabled={gradientOpacityEnabled}
24-
itemViewStyle={[styles.highlightBG, styles.mb2, styles.br3, styles.mh5]}
24+
itemViewStyle={[styles.highlightBG, styles.mb2, styles.br3, styles.ml5]}
2525
renderSkeletonItem={() => (
2626
<>
2727
<Circle

0 commit comments

Comments
 (0)