Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useFocusedInputHandler and onChangeText handler ignores an input from react-native-text-input-mask on iOS #330

Closed
kirillzyusko opened this issue Jan 12, 2024 · 0 comments · Fixed by #341
Assignees
Labels
🐛 bug Something isn't working focused input 📝 Anything about focused input functionality 🍎 iOS iOS specific

Comments

@kirillzyusko
Copy link
Owner

Describe the bug

useFocusedInputHandler and onChangeText handler ignores an input from react-native-text-input-mask on iOS

Code snippet

Example app.

Repo for reproducing

Example app.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Text input mask screen
  2. Click on TextInput

Expected behavior

In worklet section you should see an output of what user typed.

Screenshots

Smartphone (please complete the following information):

  • Desktop OS: MacOS 14.2.1
  • Device: iPhone 15 Pro
  • OS: iOS 17.2
  • RN version: 0.72.4
  • RN architecture: old
  • JS engine: Hermes
  • Library version: 1.10.1

Additional context

https://github.com/RedMadRobot/input-mask-ios?tab=readme-ov-file#uitextfieldtextdidchange-notification-and-target-action-editingchanged-event

@kirillzyusko kirillzyusko added 🐛 bug Something isn't working 🍎 iOS iOS specific focused input 📝 Anything about focused input functionality labels Jan 12, 2024
@kirillzyusko kirillzyusko self-assigned this Jan 12, 2024
kirillzyusko added a commit that referenced this issue Jan 21, 2024
…nput from `react-native-text-input-mask` on iOS (#341)

## 📜 Description

Fixed a problem when `onTextChange` is not fired on iOS if `TextInput`
from `react-native-text-input-mask`.

## 💡 Motivation and Context

The issue and solution is described
[here](https://github.com/RedMadRobot/input-mask-ios?tab=readme-ov-file#uitextfieldtextdidchange-notification-and-target-action-editingchanged-event).

However, if I add delegate with `onEditingChanged` method, then I can
not assign my listener to this callback (the delegate can not be casted
to my own type and I can not import existing class from another module
because RNKC is not depending on another module). And adding an optional
dependency to Podfile makes installation process harder and I don't see
explicit benefits of making the approach more complex.

For now I'll go with this solution (also I opened a PR to
`react-native-text-input-mask`, see
react-native-text-input-mask/react-native-text-input-mask#305).
Maybe later I'll revisit and make it more sophisticated, but for now we
have a working solution and I'm pretty happy with that.

Closes
#330

## 📢 Changelog

### Docs
- add a reference to the known problem (it should be fixable by applying
a patch);

### E2E
- added new test to check that `react-native-text-input-mask`
integration works;

### JS

- changed icon for `react-native-text-input-mask` example;
- specified `black` color for TextInput in
`react-native-text-input-mask` example;
- patched `react-native-text-input-mask` library;

## 🤔 How Has This Been Tested?

Tested on iPhone 15 Pro 17.2

## 📸 Screenshots (if appropriate):

|Before|After|
|------|------|

|![image](https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/ff1cbf24-ea58-4ffb-b5ac-5d9ab4ff64ee)|![image](https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/e08021bf-74e6-4ebc-b40e-b196f9a9a817)|

## 📝 Checklist

- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working focused input 📝 Anything about focused input functionality 🍎 iOS iOS specific
Projects
None yet
1 participant