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

Dialog content props in dialog.web.tsx primitive #31

Open
prs-wjy opened this issue Sep 9, 2024 · 0 comments
Open

Dialog content props in dialog.web.tsx primitive #31

prs-wjy opened this issue Sep 9, 2024 · 0 comments

Comments

@prs-wjy
Copy link

prs-wjy commented Sep 9, 2024

current implementation for dialog content for the web is using radix primitive

import * as Dialog from '@radix-ui/react-dialog';
...
const Content = React.forwardRef<ViewRef, SlottableViewProps & DialogContentProps>(
  (
    {
      asChild,
      forceMount,
      onOpenAutoFocus,
      onCloseAutoFocus,
      onEscapeKeyDown,
      onInteractOutside,
      onPointerDownOutside,
      ...props
    },
    ref
  ) => {
    const Component = asChild ? Slot.View : View;
    return (
      <Dialog.Content
        onOpenAutoFocus={onOpenAutoFocus}
        onCloseAutoFocus={onCloseAutoFocus}
        onEscapeKeyDown={onEscapeKeyDown}
        onInteractOutside={onInteractOutside}
        onPointerDownOutside={onPointerDownOutside}
        forceMount={forceMount}
      >
        <Component ref={ref} {...props} />
      </Dialog.Content>
    );
  }
);

The problem is we can't send any props to the Dialog.Content itself because all the props is sent directly to the child.

Example: when i pass className max-w-full max-h-full to the Dialog.Content from '@rn-primitives/dialog, it doesn't have any effect, the dialog content would not expand because we pass the className to the child instead of Dialog.Content itself.

The usage example in react-native-reusable is also broken:

<DialogContent className='sm:max-w-[425px]'>

The className='sm:max-w-[425px]' that added to the DialogContent doesn't have any effect at all because the className is added to the child insted to the DialogContent itself.

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

1 participant