Skip to content

Commit b747f14

Browse files
[MOO-2174]: replace the depricated interactionmanager (#486)
2 parents bced8a1 + 87d6f13 commit b747f14

12 files changed

Lines changed: 47 additions & 28 deletions

File tree

packages/pluggableWidgets/bottom-sheet-native/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1919
- BottomSheet now uses BottomSheetScrollView instead of BottomSheetView, enabling proper scrolling in expanded states.
2020
- NativeBottomSheet now explicitly calculates snapPoints with 90% screen height cap for predictable sizing.
2121
- CustomModalSheet now measures content height dynamically with 90% screen height cap, removing offscreen SafeAreaView measurement.
22+
- Replaced the deprecated InteractionManager in CustomModalSheet.
2223

2324
## [5.0.3] - 2025-12-15
2425

packages/pluggableWidgets/bottom-sheet-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bottom-sheet-native",
33
"widgetName": "BottomSheet",
4-
"version": "5.0.4",
4+
"version": "5.0.5",
55
"license": "Apache-2.0",
66
"repository": {
77
"type": "git",

packages/pluggableWidgets/bottom-sheet-native/src/components/CustomModalSheet.tsx

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ReactElement, ReactNode, useCallback, useEffect, useMemo, useRef, useState } from "react";
2-
import { Dimensions, InteractionManager, LayoutChangeEvent, Modal, Pressable } from "react-native";
2+
import { Dimensions, LayoutChangeEvent, Modal, Pressable } from "react-native";
33
import BottomSheet, {
44
BottomSheetBackdrop,
55
BottomSheetBackdropProps,
@@ -14,8 +14,6 @@ interface CustomModalSheetProps {
1414
styles: BottomSheetStyle;
1515
}
1616

17-
let lastIndexRef = -1;
18-
1917
export const CustomModalSheet = (props: CustomModalSheetProps): ReactElement => {
2018
const bottomSheetRef = useRef<BottomSheet>(null);
2119
const [contentHeight, setContentHeight] = useState(0);
@@ -74,15 +72,10 @@ export const CustomModalSheet = (props: CustomModalSheetProps): ReactElement =>
7472
return;
7573
}
7674

77-
const hasOpened = lastIndexRef === -1 && index === 0;
7875
const hasClosed = index === -1;
79-
lastIndexRef = index;
80-
81-
if (hasOpened) {
82-
props.triggerAttribute?.setValue(true);
83-
}
84-
if (hasClosed) {
76+
if (hasClosed && props.triggerAttribute?.value) {
8577
props.triggerAttribute?.setValue(false);
78+
setCurrentStatus(false);
8679
}
8780
},
8881
[isAvailable, props.triggerAttribute]
@@ -92,13 +85,18 @@ export const CustomModalSheet = (props: CustomModalSheetProps): ReactElement =>
9285
if (!isAvailable) {
9386
return;
9487
}
95-
if (props.triggerAttribute?.value && !currentStatus) {
96-
InteractionManager.runAfterInteractions(() => setCurrentStatus(true));
97-
} else if (!props.triggerAttribute?.value && currentStatus) {
88+
89+
const shouldBeOpen = props.triggerAttribute?.value === true;
90+
91+
if (shouldBeOpen && !currentStatus) {
92+
requestAnimationFrame(() => {
93+
setCurrentStatus(true);
94+
});
95+
} else if (!shouldBeOpen && currentStatus) {
9896
bottomSheetRef.current?.close();
9997
setCurrentStatus(false);
10098
}
101-
}, [props.triggerAttribute, currentStatus, isAvailable]);
99+
}, [props.triggerAttribute?.value, currentStatus, isAvailable]);
102100

103101
return (
104102
<Modal onRequestClose={close} transparent visible={!!isOpen}>

packages/pluggableWidgets/bottom-sheet-native/src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="BottomSheet" version="5.0.4" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="BottomSheet" version="5.0.5" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="BottomSheet.xml" />
66
</widgetFiles>

packages/pluggableWidgets/feedback-native/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Changed
10+
11+
- Replaced the deprecated InteractionManager in Feedback widget.
12+
913
## [3.4.0] - 2025-3-31
1014

1115
### Changed

packages/pluggableWidgets/feedback-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "feedback-native",
33
"widgetName": "Feedback",
4-
"version": "3.4.0",
4+
"version": "3.4.1",
55
"license": "Apache-2.0",
66
"repository": {
77
"type": "git",

packages/pluggableWidgets/feedback-native/src/Feedback.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
ActivityIndicator,
66
Dimensions,
77
Image as RNImage,
8-
InteractionManager,
98
StyleProp,
109
Switch,
1110
Text,
@@ -73,9 +72,12 @@ export class Feedback extends Component<FeedbackProps<FeedbackStyle>, State> {
7372
this.state.status === "closingDialog" &&
7473
this.state.nextStatus
7574
) {
76-
InteractionManager.runAfterInteractions(() =>
77-
this.setState(({ nextStatus }) => ({ status: nextStatus || "initial", nextStatus: undefined }))
78-
);
75+
// Use requestAnimationFrame twice to wait for the dialog close animation to complete
76+
requestAnimationFrame(() => {
77+
requestAnimationFrame(() => {
78+
this.setState(({ nextStatus }) => ({ status: nextStatus || "initial", nextStatus: undefined }));
79+
});
80+
});
7981
}
8082
}
8183

packages/pluggableWidgets/feedback-native/src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="Feedback" version="3.4.0" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="Feedback" version="3.4.1" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="Feedback.xml" />
66
</widgetFiles>

packages/pluggableWidgets/intro-screen-native/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1111
### Changed
1212

1313
- We migrated from using the native FlatList to @shopify/flash-list.
14+
- Replaced the deprecated InteractionManager in IntroScreen.
1415

1516
## [4.2.1] - 2026-1-19
1617

packages/pluggableWidgets/intro-screen-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "intro-screen-native",
33
"widgetName": "IntroScreen",
4-
"version": "4.3.0",
4+
"version": "4.3.1",
55
"license": "Apache-2.0",
66
"repository": {
77
"type": "git",

0 commit comments

Comments
 (0)