Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AlertDialog non-functional on native #2798

Open
wongk opened this issue Jul 17, 2024 · 9 comments
Open

AlertDialog non-functional on native #2798

wongk opened this issue Jul 17, 2024 · 9 comments

Comments

@wongk
Copy link

wongk commented Jul 17, 2024

Current Behavior

AlertDialog no longer opens on native. This is a regression. When the trigger is pressed, nothing happens. It works fine on web.

Expected Behavior

No response

Tamagui Version

1.102.1

Platform (Web, iOS, Android)

iOS, Android

Reproduction

<AlertDialog>
      <AlertDialog.Trigger>{trigger}</AlertDialog.Trigger>
      <AlertDialog.Portal>
        <AlertDialog.Overlay
          key="overlay"
          animation="quick"
          opacity={0.5}
          enterStyle={{ opacity: 0 }}
          exitStyle={{ opacity: 0 }}
        />
        <AlertDialog.Content
          bordered
          elevate
          key="content"
          animation={[
            "quick",
            {
              opacity: {
                overshootClamping: true,
              },
            },
          ]}
          enterStyle={{ x: 0, y: -20, opacity: 0, scale: 0.9 }}
          exitStyle={{ x: 0, y: 10, opacity: 0, scale: 0.95 }}
          x={0}
          scale={1}
          opacity={1}
          y={0}
        >
          <YStack>
            <AlertDialog.Title>{title}</AlertDialog.Title>
            <AlertDialog.Description>
              <Text>{`Are you sure you want to ${content}?`}</Text>
            </AlertDialog.Description>
            <XStack gap="$3" justifyContent="flex-end">
              <AlertDialog.Cancel asChild>
                <Button variant="containedSecondary">Cancel</Button>
              </AlertDialog.Cancel>
              <AlertDialog.Action asChild>
                <Button variant="containedPrimary" onPress={onConfirm}>
                  Confirm
                </Button>
              </AlertDialog.Action>
            </XStack>
          </YStack>
        </AlertDialog.Content>
      </AlertDialog.Portal>
    </AlertDialog>


### System Info

_No response_
@CatStudioApp
Copy link

I'm seeing the same issue...
even using PortalProvider, it does not work.

The whole app sometimes feels freezed btw

@wongk
Copy link
Author

wongk commented Jul 22, 2024

I am able to get the dialog to display when using the open attribute directly. So this issue appears to be related to using the trigger element (we are using a Button).

As a workaround you can manipulate the open state "manually".

@wongk
Copy link
Author

wongk commented Jul 23, 2024

This happens when the asChild attribute is omitted from the AlertDialog.Trigger element.

@natew
Copy link
Member

natew commented Jul 27, 2024

So must be something like it's not propagating the press from the inner to outer component?

@agrittiwari
Copy link

agrittiwari commented Aug 16, 2024

@natew Facing the same issue, you mentioned. the onPress inside the Alert portal is not listening the trigger handlePressAccept inside AlertDialog.Action when native prop is true. This issue relates to an existing issue . Although I have the older tamagui version, it seems, it is missing in the advanced versions as well.

<AlertDialog.Action asChild>
                <Button backgroundColor={'$primary'} onPress={ handlePressAccept}>
                  {acceptLabel}
                </Button>
              </AlertDialog.Action>
Screen.Recording.2024-08-16.at.1.12.38.PM.1.1.mov

@christian1koch
Copy link

@agrittiwari I have the exact same issue.

@dieguezguille
Copy link

i am also having issues with the AlertDialog on native with tamagui 1.116.1. web version works as expected but on native the dialog opens inside the component instead of being displayed full screen as it does on web

@chakrihacker
Copy link

@dieguezguille Are you using new arch and react native 0.76??

@dieguezguille
Copy link

@dieguezguille Are you using new arch and react native 0.76??

@chakrihacker Not using the New Arch, we're on react native 0.74.5 (Expo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants