ammarahm-ed / react-native-actions-sheet

A Cross Platform(Android, iOS & Web) ActionSheet with a flexible api, native performance and zero dependency code for react native. Create anything you want inside ActionSheet.
https://rnas.vercel.app
MIT License
1.42k stars 119 forks source link

[ios] Open multiple Modal ActionSheet at the same time #283

Closed Engazan closed 1 year ago

Engazan commented 1 year ago

hi is there any way to open 2 modal ActionSheet in Fragment "<></>" at the same time?

Android when i open 1st modal and click open 2nd modal -> it WORKS

iOS when i open 1st modal and click open 2nd modal -> it does but it opens it behaind all my screens so my touch wont work )

is there any way to make it work ?, i tried multiple "SheetProvider" but i think i m using them wrong, only "isModal={false}" worked for me but its terrible when i have bottomTabNavigation

demo code

const ActionModals: React.FC = (props) => {

    const mainActionSheetRef = useRef<ActionSheetRef>(null);
    const sendInvoiceActionSheetRef = useRef<ActionSheetRef>(null);

    React.useEffect(() => {
        mainActionSheetRef.current?.show();
    }, []);

    return (
        <>
            {/* main modal */}
            <ActionSheet
                ref={mainActionSheetRef}
                containerStyle={{flex: 0.60}}
            >
                <Pressable onPress={() => {
                    sendInvoiceActionSheetRef.current?.show();
                }}>
                    <Text>main modal</Text>
                </Pressable>
            </ActionSheet>

            {/* 2nd modal */}
            <ActionSheet
                ref={sendInvoiceActionSheetRef}
                containerStyle={{height: 200, justifyContent: 'center'}}
            >
                <Text>2nd modal</Text>
            </ActionSheet>
        </>
    );
}
ghorbani-m commented 1 year ago

@Engazan You can put the second action sheet inside the first action sheet as a child, it works for IOS too.