kirillzyusko / react-native-keyboard-controller

Keyboard manager which works in identical way on both iOS and Android
https://kirillzyusko.github.io/react-native-keyboard-controller/
MIT License
1.4k stars 55 forks source link

feat: `KeyboardToolbar` callbacks #419

Closed kirillzyusko closed 2 months ago

kirillzyusko commented 2 months ago

📜 Description

Added onDoneCallback/onNextCallback/onPrevCallback functions to KeyboardToolbar.

💡 Motivation and Context

It's often needed to customize behavior when buttons are pressed, for example do a haptic feedback or even play a sound.

Before this PR it wasn't possible to add an action that will be called whenever user presses a particular button along with the default action. But in this PR I added it.

Initially I wanted to provide onNextPress functions that would redefine an entire handler. But in this case users will have to go into source code and understand how KeyboardToolbar works under the hood. Even though it's not difficult it's better to keep such things internally (and in most cases users will rely on defult behavior - in case if we need to re-define a behavior I'll add new functions later).

📢 Changelog

Docs

JS

🤔 How Has This Been Tested?

Tested on Pixel 7 Pro (android 14) and iPhone 11 (iOS 17.4).

📸 Screenshots (if appropriate):

There is no way to test haptic visually 😀

📝 Checklist

github-actions[bot] commented 2 months ago

📊 Package size report

Current size Target Size Difference
128786 bytes 127406 bytes 1380 bytes 📈
github-actions[bot] commented 2 months ago

PR Preview Action v1.4.7 :---: :rocket: Deployed preview to https://kirillzyusko.github.io/react-native-keyboard-controller/pr-preview/pr-419/ on branch gh-pages at 2024-04-26 21:59 UTC

argos-ci[bot] commented 2 months ago

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

Build Status Details Updated (UTC)
default (Inspect) ✅ No change detected - Apr 26, 2024, 10:00 PM