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

refactor: `onChangeText` from delegate #435

Closed kirillzyusko closed 2 months ago

kirillzyusko commented 2 months ago

šŸ“œ Description

Consume onChangeText from delegate level.

šŸ’” Motivation and Context

To make some of functionality properly working in reach RN ecosystem you had to apply patch to react-native-text-input-mask.

However it makes it complicated in terms of setup so I always thought on how to improve it. In https://github.com/kirillzyusko/react-native-keyboard-controller/pull/426 we started to inject our delegate to intercept some TextInput events. So now we can intercept necessary events without event-bus subscription (we can take them directly from the delegate).

In this PR I re-worked this part (removed TextInputObserver class) and started to use delegate for these purposes. Also I've discovered again that we may substitute back delegate and then substitute our own again (when user typed first letter) - it's not critical but it doesn't comply with keyboard-controller delegate paradigm - we should set delegate only once (on focus) and unset it on un-focus. So I also re-worked this part and now, when we're trying to delete our observers - we check, that we are actually move focused to another input.

šŸ“¢ Changelog

Docs

E2E

iOS

šŸ¤” How Has This Been Tested?

Tested on CI and iPhone 15 Pro manually.

šŸ“ø Screenshots (if appropriate):

No visual changes.

šŸ“ Checklist

github-actions[bot] commented 2 months ago

šŸ“Š Package size report

Current size Target Size Difference
135975 bytes 136026 bytes -51 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-435/ on branch gh-pages at 2024-05-10 09:09 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 - May 10, 2024, 5:07 PM