@react-navigation/stack 7.0.2 → 7.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/utils/getShadowStyle.js +29 -0
- package/lib/commonjs/utils/getShadowStyle.js.map +1 -0
- package/lib/commonjs/views/Stack/Card.js +18 -12
- package/lib/commonjs/views/Stack/Card.js.map +1 -1
- package/lib/module/utils/getShadowStyle.js +24 -0
- package/lib/module/utils/getShadowStyle.js.map +1 -0
- package/lib/module/views/Stack/Card.js +18 -12
- package/lib/module/views/Stack/Card.js.map +1 -1
- package/lib/typescript/commonjs/src/utils/getShadowStyle.d.ts +27 -0
- package/lib/typescript/commonjs/src/utils/getShadowStyle.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/views/Stack/Card.d.ts.map +1 -1
- package/lib/typescript/commonjs/tsconfig.build.tsbuildinfo +1 -1
- package/lib/typescript/module/src/utils/getShadowStyle.d.ts +27 -0
- package/lib/typescript/module/src/utils/getShadowStyle.d.ts.map +1 -0
- package/lib/typescript/module/src/views/Stack/Card.d.ts.map +1 -1
- package/lib/typescript/module/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/utils/getShadowStyle.tsx +37 -0
- package/src/views/Stack/Card.tsx +17 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/stack",
|
|
3
3
|
"description": "Stack navigator component for iOS and Android with animated transitions and gestures",
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.0.4",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"clean": "del lib"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@react-navigation/elements": "^2.0.
|
|
54
|
+
"@react-navigation/elements": "^2.0.4",
|
|
55
55
|
"color": "^4.2.3"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@jest/globals": "^29.7.0",
|
|
59
|
-
"@react-navigation/native": "^7.0.
|
|
59
|
+
"@react-navigation/native": "^7.0.3",
|
|
60
60
|
"@testing-library/react-native": "^12.4.3",
|
|
61
61
|
"@types/color": "^3.0.6",
|
|
62
62
|
"@types/react": "~18.2.79",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"typescript": "^5.5.2"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@react-navigation/native": "^7.0.
|
|
73
|
+
"@react-navigation/native": "^7.0.3",
|
|
74
74
|
"react": ">= 18.2.0",
|
|
75
75
|
"react-native": "*",
|
|
76
76
|
"react-native-gesture-handler": ">= 2.0.0",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
]
|
|
103
103
|
]
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "113cea5770fbca7cc86594d7dac1f00c2c392eec"
|
|
106
106
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import Color from 'color';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
|
|
4
|
+
type ShadowConfig = {
|
|
5
|
+
offset: {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
};
|
|
9
|
+
radius: number;
|
|
10
|
+
opacity: number;
|
|
11
|
+
color?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function getShadowStyle({
|
|
15
|
+
offset,
|
|
16
|
+
radius,
|
|
17
|
+
opacity,
|
|
18
|
+
color = '#000',
|
|
19
|
+
}: ShadowConfig) {
|
|
20
|
+
const result = Platform.select({
|
|
21
|
+
web: {
|
|
22
|
+
boxShadow: `${offset.width}px ${offset.height}px ${radius}px ${Color(
|
|
23
|
+
color
|
|
24
|
+
)
|
|
25
|
+
.alpha(opacity)
|
|
26
|
+
.toString()}`,
|
|
27
|
+
},
|
|
28
|
+
default: {
|
|
29
|
+
shadowOffset: offset,
|
|
30
|
+
shadowRadius: radius,
|
|
31
|
+
shadowColor: color,
|
|
32
|
+
shadowOpacity: opacity,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return result;
|
|
37
|
+
}
|
package/src/views/Stack/Card.tsx
CHANGED
|
@@ -23,6 +23,7 @@ import type {
|
|
|
23
23
|
import { CardAnimationContext } from '../../utils/CardAnimationContext';
|
|
24
24
|
import { getDistanceForDirection } from '../../utils/getDistanceForDirection';
|
|
25
25
|
import { getInvertedMultiplier } from '../../utils/getInvertedMultiplier';
|
|
26
|
+
import { getShadowStyle } from '../../utils/getShadowStyle';
|
|
26
27
|
import { memoize } from '../../utils/memoize';
|
|
27
28
|
import {
|
|
28
29
|
GestureState,
|
|
@@ -610,15 +611,19 @@ const styles = StyleSheet.create({
|
|
|
610
611
|
},
|
|
611
612
|
shadow: {
|
|
612
613
|
position: 'absolute',
|
|
613
|
-
shadowRadius: 5,
|
|
614
|
-
shadowColor: '#000',
|
|
615
|
-
shadowOpacity: 0.3,
|
|
616
614
|
},
|
|
617
615
|
shadowHorizontal: {
|
|
618
616
|
top: 0,
|
|
619
617
|
bottom: 0,
|
|
620
618
|
width: 3,
|
|
621
|
-
|
|
619
|
+
...getShadowStyle({
|
|
620
|
+
offset: {
|
|
621
|
+
width: -1,
|
|
622
|
+
height: 1,
|
|
623
|
+
},
|
|
624
|
+
radius: 5,
|
|
625
|
+
opacity: 0.3,
|
|
626
|
+
}),
|
|
622
627
|
},
|
|
623
628
|
shadowStart: {
|
|
624
629
|
start: 0,
|
|
@@ -630,7 +635,14 @@ const styles = StyleSheet.create({
|
|
|
630
635
|
start: 0,
|
|
631
636
|
end: 0,
|
|
632
637
|
height: 3,
|
|
633
|
-
|
|
638
|
+
...getShadowStyle({
|
|
639
|
+
offset: {
|
|
640
|
+
width: 1,
|
|
641
|
+
height: -1,
|
|
642
|
+
},
|
|
643
|
+
radius: 5,
|
|
644
|
+
opacity: 0.3,
|
|
645
|
+
}),
|
|
634
646
|
},
|
|
635
647
|
shadowTop: {
|
|
636
648
|
top: 0,
|