@@ -5,10 +5,14 @@ import {
55 StyleSheet ,
66 type ViewStyle
77} from 'react-native' ;
8- import type { SharedValue , TransformArrayItem } from 'react-native-reanimated' ;
8+ import type {
9+ AnimatedStyle ,
10+ SharedValue ,
11+ TransformArrayItem
12+ } from 'react-native-reanimated' ;
913import Animated , { useAnimatedStyle } from 'react-native-reanimated' ;
1014
11- import { HIDDEN_X_OFFSET } from '../../../constants' ;
15+ import { HIDDEN_X_OFFSET , IS_WEB } from '../../../constants' ;
1216import type {
1317 AnimatedStyleProp ,
1418 LayoutAnimation
@@ -51,21 +55,27 @@ export default function ItemCell({
5155 ) ;
5256
5357 const animatedCellStyle = useAnimatedStyle ( ( ) => ( {
54- ...overriddenCellDimensions . value ,
5558 ...decorationStyleValue . value ,
5659 ...layoutStyleValue . value ,
5760 transform : [
5861 ...( ( layoutStyleValue . value . transform ?? [ ] ) as TransformsArray ) ,
5962 ...( ( decorationStyleValue . value . transform ?? [ ] ) as TransformsArray )
60- ]
63+ ] ,
64+ ...( ! IS_WEB && overriddenCellDimensions . value )
6165 } ) ) ;
6266
67+ let innerAnimatedStyle : AnimatedStyle | undefined ;
68+ if ( IS_WEB ) {
69+ // eslint-disable-next-line react-hooks/rules-of-hooks
70+ innerAnimatedStyle = useAnimatedStyle ( ( ) => overriddenCellDimensions . value ) ;
71+ }
72+
6373 return (
6474 < Animated . View style = { [ baseStyle , styles . decoration , animatedCellStyle ] } >
6575 < AnimatedOnLayoutView
6676 entering = { entering }
6777 exiting = { exiting }
68- style = { hidden && styles . hidden }
78+ style = { [ styles . inner , innerAnimatedStyle , hidden && styles . hidden ] }
6979 onLayout = { onLayout } >
7080 { children }
7181 </ AnimatedOnLayoutView >
@@ -93,5 +103,9 @@ const styles = StyleSheet.create({
93103 // affect item dimensions, etc., so the safest way is to put the item
94104 // far away from the viewport to hide it)
95105 left : HIDDEN_X_OFFSET
96- }
106+ } ,
107+ inner : Platform . select < ViewStyle > ( {
108+ default : { } ,
109+ web : { flex : 1 }
110+ } )
97111} ) ;
0 commit comments