Skip to content

feat: keyboard state selector#998

Merged
kirillzyusko merged 6 commits intomainfrom
feat/keyboard-state-selector
Jun 30, 2025
Merged

feat: keyboard state selector#998
kirillzyusko merged 6 commits intomainfrom
feat/keyboard-state-selector

Conversation

@kirillzyusko
Copy link
Copy Markdown
Owner

@kirillzyusko kirillzyusko commented Jun 30, 2025

📜 Description

Added ability to pass selector to useKeyboardState hook to query only necessary updates.

💡 Motivation and Context

The concept of selectors should be very familiar to many RN developers, since it's used in redux and zustand packages. I was also thinking about optimizing the amount of re-renders for this hook, but initially I've been thinking of using proxy (similar to what react-hook-form is doing). But such approach will introduce a lot of complexity, so I decided to keep the codebase simple and efficient, so added a concept of selectors.

Additionally I re-worked documnetation mainly focusing on:

  • adding a sample how useKeyboardAnimation can be used as alternative;
  • making warnings/tips shorter with corresponding references;
  • adding the usage for selectors concept;
  • use a real-world example with useKeyboardState (conditional rendering instead of changing styles).

📢 Changelog

JS

  • allow to pass selectors to useKeyboardState;

Docs

  • make warning/tips shorter with corresponding links;
  • added useKeyboardState vs useKeyboardAnimation code reference;
  • mention how to use selectors;
  • re-work example app to match real-world scenarios usage.

🤔 How Has This Been Tested?

Tested manually in example project.

📸 Screenshots (if appropriate):

Dark theme Light theme
image image

📝 Checklist

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

@kirillzyusko kirillzyusko self-assigned this Jun 30, 2025
@kirillzyusko kirillzyusko added the enhancement New feature or request label Jun 30, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 30, 2025

📊 Package size report

Current size Target Size Difference
211103 bytes 210267 bytes 836 bytes 📈

@kirillzyusko kirillzyusko added the documentation Improvements or additions to documentation label Jun 30, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 30, 2025

PR Preview Action v1.6.1

🚀 View preview at
https://kirillzyusko.github.io/react-native-keyboard-controller/pr-preview/pr-998/

Built to branch gh-pages at 2025-06-30 18:12 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@argos-ci
Copy link
Copy Markdown

argos-ci Bot commented Jun 30, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 1 changed Jun 30, 2025, 6:15 PM

@kirillzyusko kirillzyusko added the 🚀 optimization You optimize something and it becomes working faster label Jun 30, 2025
@kirillzyusko kirillzyusko marked this pull request as ready for review June 30, 2025 18:21
@kirillzyusko kirillzyusko merged commit 60ec0ce into main Jun 30, 2025
18 checks passed
@kirillzyusko kirillzyusko deleted the feat/keyboard-state-selector branch June 30, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request 🚀 optimization You optimize something and it becomes working faster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant