fix: stream actions not working
Multiple sheets compete with each other and cause silent failure on ios.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { useState } from "react";
|
||||
import { Pressable, Text, View } from "react-native";
|
||||
import {
|
||||
CircleCheckBig,
|
||||
@@ -33,13 +34,28 @@ export function StreamActionsSheet({
|
||||
isCreator,
|
||||
canDeleteParticle,
|
||||
}: StreamActionsSheetProps) {
|
||||
// Hold the picked action until the sheet's Modal has fully unmounted, then
|
||||
// dispatch. Follow-ups like rename/members open another Modal and "delete
|
||||
// particle" shows an Alert — both are iOS Modals, and iOS will not present
|
||||
// a second Modal while another is still on screen. Without this defer, the
|
||||
// tap appears to do nothing and the app feels frozen behind a phantom
|
||||
// overlay until the close animation finishes.
|
||||
const [pending, setPending] = useState<StreamActionId | null>(null);
|
||||
|
||||
const choose = (id: StreamActionId) => {
|
||||
setPending(id);
|
||||
onClose();
|
||||
onSelect(id);
|
||||
};
|
||||
|
||||
const handleClosed = () => {
|
||||
if (pending) {
|
||||
onSelect(pending);
|
||||
setPending(null);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<BottomSheet open={open} onClose={onClose}>
|
||||
<BottomSheet open={open} onClose={onClose} onClosed={handleClosed}>
|
||||
<View className="py-2">
|
||||
<ActionRow
|
||||
icon={
|
||||
|
||||
Reference in New Issue
Block a user