Provide a general summary of the issue here
The Hooks sample provided at the end of https://react-spectrum.adobe.com/react-aria/Button.html results in the following typescript error , when built as-is (i.e., using the code sample provided):
app/components/core/button.tsx:22:9 - error TS2322: Type 'ReactNode | ((values: ButtonRenderProps) => ReactNode)' is not assignable to type 'ReactNode | MotionValue<number> | MotionValue<string>'.
Type '(values: ButtonRenderProps) => ReactNode' is not assignable to type 'ReactNode | MotionValue<number> | MotionValue<string>'.
22 {props.children}
~~~~~~~~~~~~~~~~
node_modules/framer-motion/dist/index.d.ts:3177:5
3177 children?: React.ReactNode | MotionValue<number> | MotionValue<string>;
~~~~~~~~
The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & HTMLAttributesWithoutMotionProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> & MotionProps & RefAttributes<...>'
Issues seems to be related to motiondivision/motion#1723 , but not 100% sure and code-sample should build so filing separately.
🤔 Expected Behavior?
Code sample provided successuflly builds.
😯 Current Behavior
import type {ButtonProps} from 'react-aria-components';
import {ButtonContext, useContextProps} from 'react-aria-components';
import {useButton} from 'react-aria';
import {motion} from 'framer-motion';
const AnimatedButton = React.forwardRef(
(props: ButtonProps, ref: React.ForwardedRef<HTMLButtonElement>) => {
// Merge the local props and ref with the ones provided via context.
[props, ref] = useContextProps(props, ref, ButtonContext);
let { buttonProps, isPressed } = useButton(props, ref);
return (
<motion.button
{...buttonProps}
ref={ref}
animate={{
scale: isPressed ? 0.9 : 1
}}
>
{props.children} // <== Typescript error
</motion.button>
);
}
);
💁 Possible Solution
No response
🔦 Context
No response
🖥️ Steps to Reproduce
Install react-aria-components 1.0.1 to TS configured project and attempt to build, then note error.
Version
react-aria-components 1.0.1
What browsers are you seeing the problem on?
Firefox, Chrome, Safari
If other, please specify.
No response
What operating system are you using?
macOS
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
Provide a general summary of the issue here
The Hooks sample provided at the end of https://react-spectrum.adobe.com/react-aria/Button.html results in the following typescript error , when built as-is (i.e., using the code sample provided):
Issues seems to be related to motiondivision/motion#1723 , but not 100% sure and code-sample should build so filing separately.
🤔 Expected Behavior?
Code sample provided successuflly builds.
😯 Current Behavior
💁 Possible Solution
No response
🔦 Context
No response
🖥️ Steps to Reproduce
Install react-aria-components 1.0.1 to TS configured project and attempt to build, then note error.
Version
react-aria-components 1.0.1
What browsers are you seeing the problem on?
Firefox, Chrome, Safari
If other, please specify.
No response
What operating system are you using?
macOS
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response