react-native-ui-lib 7.46.3-snapshot.7392 → 7.46.3-snapshot.7403
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/package.json
CHANGED
package/package.json
CHANGED
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
},
|
|
37
37
|
{"name": "ignoreBackgroundPress", "type": "boolean", "description": "Whether or not to ignore background press."},
|
|
38
38
|
{"name": "modalProps", "type": "ModalProps", "description": "Pass props to the dialog modal"},
|
|
39
|
+
{
|
|
40
|
+
"name": "disableAnimation",
|
|
41
|
+
"type": "boolean",
|
|
42
|
+
"description": "Disable animation (default is false) \nIn some cases you might want to disable the animation (probably for Android only), this is when the dialog is scrollable and has touchable items in the scrollable area. \nThis is a temporary solution for a reanimated + RN77\\8 bug. \nSee https://github.com/software-mansion/react-native-reanimated/issues/6659 and https://github.com/facebook/react-native/issues/49694"
|
|
43
|
+
},
|
|
39
44
|
{
|
|
40
45
|
"name": "testID",
|
|
41
46
|
"type": "string",
|
|
@@ -30,6 +30,7 @@ const Dialog = (props, ref) => {
|
|
|
30
30
|
ignoreBackgroundPress,
|
|
31
31
|
modalProps = {},
|
|
32
32
|
useSafeArea,
|
|
33
|
+
disableAnimation = false,
|
|
33
34
|
testID,
|
|
34
35
|
children
|
|
35
36
|
} = props;
|
|
@@ -138,7 +139,7 @@ const Dialog = (props, ref) => {
|
|
|
138
139
|
const style = useMemo(() => {
|
|
139
140
|
return [styles.defaultDialogStyle, {
|
|
140
141
|
backgroundColor: Colors.$backgroundDefault
|
|
141
|
-
}, containerStyle, animatedStyle, width ? {
|
|
142
|
+
}, containerStyle, disableAnimation ? undefined : animatedStyle, width ? {
|
|
142
143
|
width
|
|
143
144
|
} : undefined, height ? {
|
|
144
145
|
height
|
|
@@ -118,6 +118,13 @@ export interface _DialogProps extends AlignmentModifiers, Pick<ViewProps, 'useSa
|
|
|
118
118
|
* Additional props for the modal.
|
|
119
119
|
*/
|
|
120
120
|
modalProps?: ModalProps;
|
|
121
|
+
/**
|
|
122
|
+
* Disable animation (default is false)
|
|
123
|
+
* In some cases you might want to disable the animation (probably for Android only), this is when the dialog is scrollable and has touchable items in the scrollable area.
|
|
124
|
+
* This is a temporary solution for a reanimated + RN77\8 bug.
|
|
125
|
+
* See https://github.com/software-mansion/react-native-reanimated/issues/6659 and https://github.com/facebook/react-native/issues/49694
|
|
126
|
+
*/
|
|
127
|
+
disableAnimation?: boolean;
|
|
121
128
|
/**
|
|
122
129
|
* Used to locate this view in end-to-end tests
|
|
123
130
|
* The container has the unchanged id.
|
|
@@ -23,6 +23,9 @@ export default function TabPage({
|
|
|
23
23
|
containerWidth
|
|
24
24
|
} = useContext(TabBarContext);
|
|
25
25
|
const [shouldLoad, setLoaded] = useState(!lazy);
|
|
26
|
+
|
|
27
|
+
// TODO: RN 77 hack - remove the state in future RN\reanimated release (ticket 4838 \ https://github.com/software-mansion/react-native-reanimated/issues/8517)
|
|
28
|
+
const [isActive, setIsActive] = useState(currentPage.value === index);
|
|
26
29
|
// const [focused, setFocused] = useState(false);
|
|
27
30
|
|
|
28
31
|
const lazyLoad = useCallback(() => {
|
|
@@ -36,6 +39,7 @@ export default function TabPage({
|
|
|
36
39
|
return currentPage.value;
|
|
37
40
|
}, (currentPage /* , previousPage */) => {
|
|
38
41
|
const isActive = currentPage === index;
|
|
42
|
+
runOnJS(setIsActive)(isActive);
|
|
39
43
|
// const wasActive = previousPage === index;
|
|
40
44
|
// const nearActive = asCarousel && (currentPage - 1 === index || currentPage + 1 === index);
|
|
41
45
|
// const wasNearActive =
|
|
@@ -52,23 +56,25 @@ export default function TabPage({
|
|
|
52
56
|
// }
|
|
53
57
|
}, [currentPage, lazyLoad]);
|
|
54
58
|
const animatedPageStyle = useAnimatedStyle(() => {
|
|
59
|
+
if (!nestedInScrollView) {
|
|
60
|
+
return {};
|
|
61
|
+
}
|
|
55
62
|
const isActive = Math.round(currentPage.value) === index;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const style = {
|
|
59
|
-
opacity: isActive || asCarousel ? 1 : 0,
|
|
60
|
-
zIndex: isActive || asCarousel ? 1 : 0
|
|
63
|
+
return {
|
|
64
|
+
position: isActive ? 'relative' : 'absolute'
|
|
61
65
|
};
|
|
62
|
-
if (nestedInScrollView) {
|
|
63
|
-
style.position = isActive ? 'relative' : 'absolute';
|
|
64
|
-
}
|
|
65
|
-
return style;
|
|
66
66
|
});
|
|
67
67
|
const _style = useMemo(() => {
|
|
68
68
|
return [!asCarousel && styles.page, animatedPageStyle, {
|
|
69
69
|
width: asCarousel ? containerWidth : undefined
|
|
70
|
-
}, style
|
|
71
|
-
|
|
70
|
+
}, style, !isActive && !asCarousel ? {
|
|
71
|
+
opacity: 0,
|
|
72
|
+
zIndex: 0
|
|
73
|
+
} : {
|
|
74
|
+
opacity: 1,
|
|
75
|
+
zIndex: 1
|
|
76
|
+
}];
|
|
77
|
+
}, [asCarousel, animatedPageStyle, containerWidth, style, isActive]);
|
|
72
78
|
return <Reanimated.View style={_style} testID={testID}>
|
|
73
79
|
{!shouldLoad && renderLoading?.()}
|
|
74
80
|
{shouldLoad && props.children}
|
|
@@ -76,7 +82,5 @@ export default function TabPage({
|
|
|
76
82
|
</Reanimated.View>;
|
|
77
83
|
}
|
|
78
84
|
const styles = StyleSheet.create({
|
|
79
|
-
page:
|
|
80
|
-
...StyleSheet.absoluteFillObject
|
|
81
|
-
}
|
|
85
|
+
page: StyleSheet.absoluteFillObject
|
|
82
86
|
});
|