Skip to content

[menu-bar] Optimize code for React 19 #307

Merged
gabrieldonadel merged 6 commits intomainfrom
@gabrieldonadel/react-19
Feb 3, 2026
Merged

[menu-bar] Optimize code for React 19 #307
gabrieldonadel merged 6 commits intomainfrom
@gabrieldonadel/react-19

Conversation

@gabrieldonadel
Copy link
Copy Markdown
Member

@gabrieldonadel gabrieldonadel commented Feb 2, 2026

Why

Now that we updated React to version 19, we can take advantage of some new features

How

  • Migrate React.forwardRef to ref as a prop
  • Use simplified context syntax
  • Remove babel-plugin-react-compiler explicit dependency

Test Plan

Run menu-bar locally

@gabrieldonadel gabrieldonadel changed the title [menu-bar] optimize code for React 19 [menu-bar] Optimize code for React 19 Feb 2, 2026
@gabrieldonadel gabrieldonadel marked this pull request as ready for review February 2, 2026 22:11
Copy link
Copy Markdown
Contributor

@tsapeta tsapeta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just two nitpicks 😉

Comment on lines +23 to +26
ref?: React.Ref<{ setNative: (native: { value?: boolean }) => void }>;
}) => {
const nativeSwitchRef = useRef<React.ElementRef<typeof NativeCheckbox> | null>(null);
const [native, setNative] = useState<{ value?: boolean }>({ value: undefined });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • { value?: boolean } appears in two places so maybe it deserves a type declaration 😄
  • does the value actually need to be wrapped in an object?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh this code was just copied from the react-native-macos Switch.js a few years ago. Let me refactor this

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@gabrieldonadel gabrieldonadel merged commit 9d1b1c8 into main Feb 3, 2026
1 check passed
@gabrieldonadel gabrieldonadel deleted the @gabrieldonadel/react-19 branch February 3, 2026 00:44
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

Successfully merging this pull request may close these issues.

2 participants