Skip to content

Commit 286cac2

Browse files
authored
fix: Quick fix for added item flickering (#275)
## Description The newly added item to the sortable component had an invalid style with opacity 1 instead of 0, which made it visible in the incorrect position. This PR is a quick fix for this issue.
1 parent 21a23ce commit 286cac2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/react-native-sortables/src/providers/shared/hooks/useItemLayoutStyles.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ import { useCommonValuesContext } from '../CommonValuesProvider';
1313
import useItemZIndex from './useItemZIndex';
1414

1515
const RELATIVE_STYLE: ViewStyle = {
16-
height: undefined,
1716
left: undefined,
1817
opacity: 1,
1918
position: 'relative',
2019
top: undefined,
2120
transform: [],
22-
width: undefined,
2321
zIndex: 0
2422
};
2523

@@ -140,7 +138,10 @@ export default function useItemLayoutStyles(
140138
);
141139

142140
const animatedTranslationStyle = useAnimatedStyle(() => {
143-
if (layoutX.value === null || layoutY.value === null) {
141+
if (
142+
!canSwitchToAbsoluteLayout.value &&
143+
(layoutX.value === null || layoutY.value === null)
144+
) {
144145
return RELATIVE_STYLE;
145146
}
146147

0 commit comments

Comments
 (0)