MCPcopy
hub / github.com/callstack/react-native-paper / v3Shadow

Function v3Shadow

src/styles/shadow.tsx:73–109  ·  view source on GitHub ↗
(elevation: number | Animated.Value = 0)

Source from the content-addressed store, hash-verified

71}
72
73function v3Shadow(elevation: number | Animated.Value = 0) {
74 const inputRange = [0, 1, 2, 3, 4, 5];
75 const shadowHeight = [0, 1, 2, 4, 6, 8];
76 const shadowRadius = [0, 3, 6, 8, 10, 12];
77
78 if (elevation instanceof Animated.Value) {
79 return {
80 shadowColor: MD3_SHADOW_COLOR,
81 shadowOffset: {
82 width: new Animated.Value(0),
83 height: elevation.interpolate({
84 inputRange,
85 outputRange: shadowHeight,
86 }),
87 },
88 shadowOpacity: elevation.interpolate({
89 inputRange: [0, 1],
90 outputRange: [0, MD3_SHADOW_OPACITY],
91 extrapolate: 'clamp',
92 }),
93 shadowRadius: elevation.interpolate({
94 inputRange,
95 outputRange: shadowRadius,
96 }),
97 };
98 } else {
99 return {
100 shadowColor: MD3_SHADOW_COLOR,
101 shadowOpacity: elevation ? MD3_SHADOW_OPACITY : 0,
102 shadowOffset: {
103 width: 0,
104 height: shadowHeight[elevation],
105 },
106 shadowRadius: shadowRadius[elevation],
107 };
108 }
109}

Callers 1

shadowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…