Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ export function useCloseAlert(props: UseCloseAlertProps) {
const { alertRef } = props;
const closeAlert = React.useCallback(
(onFinished?: () => void) => {
const _onFinished = typeof onFinished === 'function' ? onFinished : undefined;
alertRef.current?.close?.(() => {
onFinished?.();
_onFinished?.();
});
},
[alertRef]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ export function useCloseMenu(props: UseCloseMenuProps) {
const { menuRef } = props;
const closeMenu = React.useCallback(
(onFinished?: () => void) => {
const _onFinished = typeof onFinished === 'function' ? onFinished : undefined;
menuRef.current?.startHide?.(() => {
onFinished?.();
_onFinished?.();
});
},
[menuRef]
Expand Down
40 changes: 22 additions & 18 deletions packages/react-native-chat-uikit/src/ui/Modal/SlideModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,7 @@ export function SlideModal(props: SlideModalProps) {

if (propsRef.current) {
propsRef.current.startShow = (onf?: () => void, timeout?: number) => {
setVisible(true);
setTimeout(() => {
if (timeout !== undefined) {
startShow(() => {
timeoutTask(timeout, () => {
onf?.();
});
});
} else {
startShow(() => {
onf?.();
});
}
}, 16); // one frame's delay
// 使用 InteractionManager 确保动画在主线程执行
// InteractionManager.runAfterInteractions(() => {
// if (timeout !== undefined) {
// startShow(() => {
Expand All @@ -75,15 +62,31 @@ export function SlideModal(props: SlideModalProps) {
// });
// }
// });
const _onf = typeof onf === 'function' ? onf : undefined;
setVisible(true);
setTimeout(() => {
if (timeout !== undefined) {
startShow(() => {
timeoutTask(timeout, () => {
_onf?.();
});
});
} else {
startShow(() => {
_onf?.();
});
}
}, 16); // one frame's delay

if (timeout !== undefined) {
startShow(() => {
timeoutTask(timeout, () => {
onf?.();
_onf?.();
});
});
} else {
startShow(() => {
onf?.();
_onf?.();
});
}
};
Expand Down Expand Up @@ -133,18 +136,19 @@ export function SlideModal(props: SlideModalProps) {
// }, 50);
// });
// }
const _onf = typeof onf === 'function' ? onf : undefined;
if (timeout !== undefined) {
startHide(() => {
setVisible(false);
timeoutTask(timeout, () => {
onf?.();
_onf?.();
onFinished?.();
});
});
} else {
startHide(() => {
setVisible(false);
onf?.();
_onf?.();
onFinished?.();
});
}
Expand Down