File tree Expand file tree Collapse file tree 1 file changed +18
-20
lines changed Expand file tree Collapse file tree 1 file changed +18
-20
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,23 @@ export const ContributionChart: FC<ContributionChartProps> = ({
166
166
const dataIndex = weekIndex * 7 + dayIndex ;
167
167
const isValidData = day && day . value !== undefined ;
168
168
169
+ // Create cell style
170
+ const cellStyle = {
171
+ ...styles . cell ,
172
+ width : cellSize ,
173
+ height : cellSize ,
174
+ margin : cellSpacing / 2 ,
175
+ borderRadius : cellBorderRadius ,
176
+ backgroundColor : isValidData
177
+ ? getColorForValue ( day . value )
178
+ : 'transparent' ,
179
+ } ;
180
+
181
+ // Create animation style
182
+ const animationStyle = {
183
+ opacity : isValidData ? animatedValues [ dataIndex ] : 0 ,
184
+ } ;
185
+
169
186
return (
170
187
< TouchableOpacity
171
188
key = { dayIndex }
@@ -182,26 +199,7 @@ export const ContributionChart: FC<ContributionChartProps> = ({
182
199
}
183
200
} }
184
201
>
185
- < Animated . View
186
- style = { [
187
- styles . cell ,
188
- {
189
- width : cellSize ,
190
- height : cellSize ,
191
- margin : cellSpacing / 2 ,
192
- borderRadius : cellBorderRadius ,
193
- backgroundColor : isValidData
194
- ? getColorForValue ( day . value )
195
- : 'transparent' ,
196
- opacity : isValidData
197
- ? animatedValues [ dataIndex ] ?. interpolate ( {
198
- inputRange : [ 0 , 1 ] ,
199
- outputRange : [ 0 , 1 ] ,
200
- } )
201
- : 0 ,
202
- } ,
203
- ] }
204
- />
202
+ < Animated . View style = { [ cellStyle , animationStyle ] } />
205
203
</ TouchableOpacity >
206
204
) ;
207
205
} ) }
You can’t perform that action at this time.
0 commit comments