Created
September 15, 2022 17:21
-
-
Save DanielSmith/957a0a0a9d791ab2a95ffb15c5f0e6cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Greetings, I am porting a few react-aria examples to remix | |
the one that is giving me trouble is | |
AlertDialog (the example from https://react-spectrum.adobe.com/react-aria/useDialog.html#example) | |
If I go to the codesandbox @ | |
https://codesandbox.io/s/delicate-hill-j4p5vs?file=/package.json | |
and export the zip... | |
and then npm install | |
then npm run start | |
(This is unchanged from the zip that gets exported) | |
I get the errors below. The example still works for straight react. It does not for remix (will show that below) | |
webpack compiled successfully | |
Files successfully emitted, waiting for typecheck results... | |
Issues checking in progress... | |
ERROR in src/AlertDialog.tsx:2:15 | |
TS2305: Module '"../node_modules/@react-aria/overlays/dist/types"' has no exported member 'OverlayProps'. | |
1 | import type { AriaDialogProps } from "@react-types/dialog"; | |
> 2 | import type { OverlayProps } from "@react-aria/overlays"; | |
| ^^^^^^^^^^^^ | |
3 | import React from "react"; | |
4 | import { | |
5 | useOverlay, | |
ERROR in src/AlertDialog.tsx:24:19 | |
TS2339: Property 'onClose' does not exist on type 'AlertDialogProps'. | |
22 | | |
23 | export function AlertDialog(props: AlertDialogProps) { | |
> 24 | let { children, onClose, confirmLabel } = props; | |
| ^^^^^^^ | |
25 | | |
26 | let ref = React.useRef(null); | |
27 | let { overlayProps, underlayProps } = useOverlay(props, ref); | |
ERROR in src/AlertDialog.tsx:27:52 | |
TS2559: Type 'AlertDialogProps' has no properties in common with type 'AriaOverlayProps'. | |
25 | | |
26 | let ref = React.useRef(null); | |
> 27 | let { overlayProps, underlayProps } = useOverlay(props, ref); | |
| ^^^^^ | |
28 | usePreventScroll(); | |
29 | let { modalProps } = useModal(); | |
30 | let { dialogProps, titleProps } = useDialog( | |
ERROR in src/AlertDialog.tsx:41:17 | |
TS2339: Property 'isOpen' does not exist on type 'AlertDialogProps'. | |
39 | // Animate opacity and backdrop blur of underlay | |
40 | <CSSTransition | |
> 41 | in={props.isOpen} | |
| ^^^^^^ | |
42 | unmountOnExit | |
43 | timeout={{ enter: 0, exit: 250 }} | |
44 | classNames={{ | |
ERROR in src/AlertDialog.tsx:57:23 | |
TS2339: Property 'isOpen' does not exist on type 'AlertDialogProps'. | |
55 | {/* Animate dialog slightly upward when entering, and downward when exiting. */} | |
56 | <CSSTransition | |
> 57 | in={props.isOpen} | |
| ^^^^^^ | |
58 | appear | |
59 | nodeRef={ref} | |
60 | timeout={{ enter: 0, exit: 250 }} | |
ERROR in src/App.tsx:17:11 | |
TS2322: Type '{ children: string; isOpen: boolean; title: string; confirmLabel: string; variant: "destructive"; onClose: () => void; }' is not assignable to type 'IntrinsicAttributes & AlertDialogProps'. | |
Property 'isOpen' does not exist on type 'IntrinsicAttributes & AlertDialogProps'. | |
15 | <OverlayContainer> | |
16 | <AlertDialog | |
> 17 | isOpen={isOpen} | |
| ^^^^^^ | |
18 | title="Delete folder" | |
19 | confirmLabel="Delete" | |
20 | variant="destructive" | |
--- | |
the remix error: | |
Application Error | |
$f57aed4a881a3485$export$33ffd74ebf07f0602@http://localhost:3000/build/routes/index-MMUJ3DJA.js:19945:11 | |
AlertDialog@http://localhost:3000/build/routes/index-MMUJ3DJA.js:21239:24 | |
renderWithHooks@http://localhost:3000/build/_shared/chunk-K7QDLLMA.js:11761:35 | |
mountIndeterminateComponent@http://localhost:3000/build/_shared/chunk-K7QDLLMA.js:14490:21 | |
beginWork@http://localhost:3000/build/_shared/chunk-K7QDLLMA.js:15445:22 | |
beginWork$1@http://localhost:3000/build/_shared/chunk-K7QDLLMA.js:19246:22 | |
performUnitOfWork@http://localhost:3000/build/_shared/chunk-K7QDLLMA.js:18694:20 | |
workLoopSync@http://localhost:3000/build/_shared/chunk-K7QDLLMA.js:18630:30 | |
renderRootSync@http://localhost:3000/build/_shared/chunk-K7QDLLMA.js:18609:15 | |
recoverFromConcurrentError@http://localhost:3000/build/_shared/chunk-K7QDLLMA.js:18231:42 | |
performConcurrentWorkOnRoot@http://localhost:3000/build/_shared/chunk-K7QDLLMA.js:18179:30 | |
workLoop@http://localhost:3000/build/_shared/chunk-K7QDLLMA.js:195:50 | |
flushWork@http://localhost:3000/build/_shared/chunk-K7QDLLMA.js:174:22 | |
performWorkUntilDeadline@http://localhost:3000/build/_shared/chunk-K7QDLLMA.js:382:29 | |
thanks, I will check that out. What I did not appreciate was the example author saying "Sorry it wasn’t easy enough for you". It was his mistake for not updating his own example. It was condescending.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OverlayProps
should beAriaOverlayProps
. This changed with https://github.com/adobe/react-spectrum/pull/3326/files#diff-6824254daab8a81b5b0cdb3845a06623eda41b64667b29f6abee7ef51da9c2afR17, which added exports for types from all packages.See https://codesandbox.io/s/long-wave-3vlmeb?file=/src/AlertDialog.tsx