Skip to content

feat: use keyboardAppearance instead of global appearance#1004

Merged
kirillzyusko merged 3 commits intomainfrom
fix/use-keyboard-appearance-instead-of-global-appearance
Jul 8, 2025
Merged

feat: use keyboardAppearance instead of global appearance#1004
kirillzyusko merged 3 commits intomainfrom
fix/use-keyboard-appearance-instead-of-global-appearance

Conversation

@kirillzyusko
Copy link
Copy Markdown
Owner

@kirillzyusko kirillzyusko commented Jul 3, 2025

📜 Description

Removed default as a possible value of appearance property.

💡 Motivation and Context

The thing is that for default a real keyboard appearance can be dark or light depending on device preferences. In this PR I decided to combine the logic on a native side and simplify JS logic, so for that I removed default as a possible value from a native side.

The other improvement is that we can consume appearance property from useKeyboardState. For that I had a separate listener to KeyboardEvents (keyboardWillShow event), because we need to know the actual field value before keyboard appears.

I removed a code that was responsible for detecting keyboard color from KeyboardToolbar - now we can just use const appearance = useKeyboardState(state => state.appearance) and don't go to low level stuff with setting up listeners. Just pass selector 😎

📢 Changelog

JS

  • change appearance in useKeyboardState hook on willShow event;
  • use useKeyboardState instead of useColorScheme;

iOS

  • remove default as possible value for appearance;

Android

  • remove default as possible value for appearance;

🤔 How Has This Been Tested?

Tested manually in example app.

📸 Screenshots (if appropriate):

images taken when you set keyboardAppearance="dark"

Before After
image image

📝 Checklist

  • CI successfully passed
  • I added new mocks and corresponding unit-tests if library API was changed

@kirillzyusko kirillzyusko self-assigned this Jul 3, 2025
@kirillzyusko kirillzyusko added enhancement New feature or request 🚨 requires API changes 🚨 Changes that requires changes in library API KeyboardToolbar Anything related to KeyboardToolbar component labels Jul 3, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 3, 2025

📊 Package size report

Current size Target Size Difference
207795 bytes 207793 bytes 2 bytes 📈

@kirillzyusko kirillzyusko marked this pull request as ready for review July 8, 2025 17:43
@kirillzyusko kirillzyusko merged commit 27fce1c into main Jul 8, 2025
26 checks passed
@kirillzyusko kirillzyusko deleted the fix/use-keyboard-appearance-instead-of-global-appearance branch July 8, 2025 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request KeyboardToolbar Anything related to KeyboardToolbar component 🚨 requires API changes 🚨 Changes that requires changes in library API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant