({
isAnimatedFromRight,
isIconStatic,
distance,
animFAB,
}: GetCombinedStylesProps)
| 35 | }; |
| 36 | |
| 37 | export const getCombinedStyles = ({ |
| 38 | isAnimatedFromRight, |
| 39 | isIconStatic, |
| 40 | distance, |
| 41 | animFAB, |
| 42 | }: GetCombinedStylesProps): CombinedStyles => { |
| 43 | const { isRTL } = I18nManager; |
| 44 | |
| 45 | const defaultPositionStyles = { left: -distance, right: undefined }; |
| 46 | |
| 47 | const combinedStyles: CombinedStyles = { |
| 48 | innerWrapper: { |
| 49 | ...defaultPositionStyles, |
| 50 | }, |
| 51 | iconWrapper: { |
| 52 | ...defaultPositionStyles, |
| 53 | }, |
| 54 | absoluteFill: {}, |
| 55 | }; |
| 56 | |
| 57 | const animatedFromRight = isAnimatedFromRight && !isRTL; |
| 58 | const animatedFromRightRTL = isAnimatedFromRight && isRTL; |
| 59 | const animatedFromLeft = !isAnimatedFromRight && !isRTL; |
| 60 | const animatedFromLeftRTL = !isAnimatedFromRight && isRTL; |
| 61 | |
| 62 | if (animatedFromRight) { |
| 63 | combinedStyles.innerWrapper.transform = [ |
| 64 | { |
| 65 | translateX: animFAB.interpolate({ |
| 66 | inputRange: [distance, 0], |
| 67 | outputRange: [distance, 0], |
| 68 | }), |
| 69 | }, |
| 70 | ]; |
| 71 | combinedStyles.iconWrapper.transform = [ |
| 72 | { |
| 73 | translateX: isIconStatic ? 0 : animFAB, |
| 74 | }, |
| 75 | ]; |
| 76 | combinedStyles.absoluteFill.transform = [ |
| 77 | { |
| 78 | translateX: animFAB.interpolate({ |
| 79 | inputRange: [distance, 0], |
| 80 | outputRange: [Math.abs(distance) / 2, Math.abs(distance)], |
| 81 | }), |
| 82 | }, |
| 83 | ]; |
| 84 | } else if (animatedFromRightRTL) { |
| 85 | combinedStyles.iconWrapper.transform = [ |
| 86 | { |
| 87 | translateX: isIconStatic |
| 88 | ? 0 |
| 89 | : animFAB.interpolate({ |
| 90 | inputRange: [distance, 0], |
| 91 | outputRange: [-distance, 0], |
| 92 | }), |
| 93 | }, |
| 94 | ]; |
no outgoing calls
no test coverage detected
searching dependent graphs…