Skip to content

useCalendar - navigation button props contain an (unknown?) onFocusChange prop #5170

Answered by reidbarber
PrettyCoffee asked this question in Q&A
Discussion options

You must be logged in to vote

You'll need to spread prevButtonProps/ nextButtonProps onto a button created with useButton. You can update your example to this instead:

function Button(props) {
  const ref = useRef(null);
  const { buttonProps } = useButton(props, ref);
  return <button {...buttonProps} ref={ref}>{props.children}</button>;
}

https://codesandbox.io/p/sandbox/hungry-mccarthy-pjdm4y

This is because prevButtonProps/ nextButtonProps contain handlers such as onPress and onFocusChange that aren't attributes of native buttons.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@PrettyCoffee
Comment options

Answer selected by PrettyCoffee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants