File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import Animated, {
77 useAnimatedReaction ,
88 useAnimatedRef ,
99 useAnimatedStyle ,
10+ useReducedMotion ,
1011 useSharedValue ,
1112 withDelay ,
1213 withTiming ,
@@ -27,6 +28,8 @@ const Expandable = ({
2728 easing ?: EasingFunction | undefined ;
2829 children : JSX . Element | JSX . Element [ ] ;
2930} ) => {
31+ const reducedMotion = useReducedMotion ( ) ;
32+
3033 const [ localIsExpanded , setLocalIsExpanded ] = React . useState ( false ) ;
3134 const [ isCollapsing , setIsCollapsing ] = React . useState ( false ) ;
3235 const delay = renderWhenCollapsed ? 100 : 0 ;
@@ -119,6 +122,10 @@ const Expandable = ({
119122 [ innerComponentHeightSV , localIsExpanded , expanded ]
120123 ) ;
121124
125+ if ( reducedMotion ) {
126+ return expanded ? children : null ;
127+ }
128+
122129 return (
123130 < Animated . View
124131 style = { [
You can’t perform that action at this time.
0 commit comments