diff --git a/src/components/FAB/AnimatedFAB.tsx b/src/components/FAB/AnimatedFAB.tsx index 84ea8c6321..a6f790f019 100644 --- a/src/components/FAB/AnimatedFAB.tsx +++ b/src/components/FAB/AnimatedFAB.tsx @@ -314,6 +314,12 @@ const AnimatedFAB = ({ const md2Elevation = disabled || !isIOS ? 0 : 6; const md3Elevation = disabled || !isIOS ? 0 : 3; + const shadowStyle = isV3 ? styles.v3Shadow : styles.shadow; + const baseStyle = [ + StyleSheet.absoluteFill, + disabled ? styles.disabled : shadowStyle, + ]; + const newAccessibilityState = { ...accessibilityState, disabled }; return ( @@ -359,8 +365,7 @@ const AnimatedFAB = ({ { textTransform: 'uppercase', }); }); + +it('renders correct elevation value for shadow views', () => { + const { getByTestId } = render( + {}} + icon="plus" + testID="animated-fab" + /> + ); + + expect(getByTestId('animated-fab-shadow')).toHaveStyle({ elevation: 3 }); + expect(getByTestId('animated-fab-extended-shadow')).toHaveStyle({ + elevation: 3, + }); +}); diff --git a/src/components/__tests__/__snapshots__/AnimatedFAB.test.tsx.snap b/src/components/__tests__/__snapshots__/AnimatedFAB.test.tsx.snap index ddefdd96be..a94fe7e0b8 100644 --- a/src/components/__tests__/__snapshots__/AnimatedFAB.test.tsx.snap +++ b/src/components/__tests__/__snapshots__/AnimatedFAB.test.tsx.snap @@ -85,7 +85,7 @@ exports[`renders animated fab 1`] = ` Object { "borderRadius": 16, "bottom": 0, - "elevation": 6, + "elevation": 3, "left": 0, "opacity": 0, "position": "absolute", @@ -94,6 +94,7 @@ exports[`renders animated fab 1`] = ` "width": 72, } } + testID="animated-fab-extended-shadow" />