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

Custom arrow causes a warning in the console #402

Open
HejKatya opened this issue Aug 10, 2023 · 3 comments
Open

Custom arrow causes a warning in the console #402

HejKatya opened this issue Aug 10, 2023 · 3 comments

Comments

@HejKatya
Copy link

Describe the bug
Custom arrow causes a warning in the console: **Warning: Received false for a non-boolean attribute rtl. If you want to write it to the DOM, pass a string instead: rtl="false" or rtl={value.toString()}.

If you used to conditionally omit it with rtl={condition && value}, pass rtl={condition ? value : undefined} instead.**

To Reproduce
Create a custom arrow

Expected behaivor
No warnings

Screenshots
(screenshots of the warning, the arrow functions and the carousel itself)

Screen Shot 2023-08-10 at 18 17 36
Screen Shot 2023-08-10 at 18 20 38
Screen Shot 2023-08-10 at 18 20 45

@Govinda04
Copy link

Govinda04 commented Nov 22, 2023

Hi, Can you provide the '...restArrowProps'?

I suspect that '...restArrowProps' has some prop that gets the boolean value, but expects the other type of value instead of boolean

@Govinda04
Copy link

Govinda04 commented Nov 22, 2023

Actually reading the files i found that arrowProps which you populate are also have one extra prop 'rtl' which is boolean
It has Interface for prop like below

interface RightArrowProps {
  customRightArrow?: React.ReactElement<any> | null;
  getState: () => StateCallBack;
  next: () => void;
  disabled?: boolean;
  rtl?: boolean;
}

where it provides rtl

you can also skip rtl by doing
const { carouselState, children, rtl, ...restArrowProps } = arrowProps

@AshishRaj04
Copy link

`const customleftarrow = (


<ArrowBackIcon sx={{ color: "white" }} />

);

const customrightarrow = (


<ArrowForwardIcon sx={{ color: "white" }} />

);
const ArrowFix = (arrowProps) => { const {carouselState, children,rtl, ...restArrowProps} = arrowProps; return ( <span {...restArrowProps}> {children} ); };

return (


<Carousel

    customLeftArrow={<ArrowFix> {customleftarrow} </ArrowFix>}
    customRightArrow={<ArrowFix> {customrightarrow} </ArrowFix>}
    
  >
   // ITEMS TO BE PUT INSIDE 
  </Carousel>`

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

3 participants