Skip to content

[iOS] Paper: TextInput maxLength is not working in old arch#48126

Closed
mateoguzmana wants to merge 1 commit intofacebook:mainfrom
mateoguzmana:fix/max-length-text-input-not-working-in-paper
Closed

[iOS] Paper: TextInput maxLength is not working in old arch#48126
mateoguzmana wants to merge 1 commit intofacebook:mainfrom
mateoguzmana:fix/max-length-text-input-not-working-in-paper

Conversation

@mateoguzmana
Copy link
Collaborator

@mateoguzmana mateoguzmana commented Dec 5, 2024

Summary:

Fixes #47563

It seems like a regression from #45401, where it was aimed to fix onChangeText being called multiple times when changing the text programmatically in an input with the multiline prop set as true.

This PR reverts that partially, as the maxLength check is not being evaluated correctly before setting the text. Not reverting it completely as when removing the second part of the fix, the onChangeText gets called multiple times again.

Changelog:

[IOS] [FIXED] - Fixing TextInput maxLength not working in old arch

Test Plan:

The issue could be reproduced in the rn-tester. See my videos with the before and after the fix.

Before:
Screen.Recording.2024-12-05.at.18.55.39.mov
After:
Screen.Recording.2024-12-05.at.18.53.27.mov

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 5, 2024
@mateoguzmana mateoguzmana changed the title fix(text-input): [ios][paper] fixing max length [iOS][Paper] TextInput maxLength is not working Dec 5, 2024
@mateoguzmana mateoguzmana changed the title [iOS][Paper] TextInput maxLength is not working [iOS] Paper: TextInput maxLength is not working Dec 5, 2024
@mateoguzmana mateoguzmana changed the title [iOS] Paper: TextInput maxLength is not working [iOS] Paper: TextInput maxLength is not working in old arch Dec 5, 2024
@mateoguzmana mateoguzmana marked this pull request as ready for review December 5, 2024 20:23
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Dec 5, 2024
Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

1 similar comment
@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Dec 10, 2024
@facebook-github-bot
Copy link
Contributor

@cipolleschi merged this pull request in 9ecf290.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @mateoguzmana in 9ecf290

When will my fix make it into a release? | How to file a pick request?

cipolleschi pushed a commit that referenced this pull request Jan 8, 2025
Summary:
Fixes #47563

It seems like a regression from #45401, where it was aimed to fix `onChangeText` being called multiple times when changing the text programmatically in an input with the `multiline` prop set as true.

This PR reverts that partially, as the `maxLength` check is not being evaluated correctly before setting the text. Not reverting it completely as when removing the second part of the fix, the `onChangeText` gets called multiple times again.

## Changelog:

[IOS] [FIXED] - Fixing TextInput `maxLength` not working in old arch

Pull Request resolved: #48126

Test Plan:
The issue could be reproduced in the rn-tester. See my videos with the before and after the fix.

<details>
<summary>Before:</summary>

https://github.com/user-attachments/assets/86fd67eb-fc14-469a-a5f8-8e83b49f857c

</details>

<details>
<summary>After:</summary>

https://github.com/user-attachments/assets/368383b1-c1bd-4e0b-ac44-c78022462fa0

</details>

Reviewed By: cortinico

Differential Revision: D67025182

Pulled By: cipolleschi

fbshipit-source-id: 720c400eef362618106ae434aef421c7529214fe
robhogan pushed a commit that referenced this pull request Jan 15, 2025
Summary:
Fixes #47563

It seems like a regression from #45401, where it was aimed to fix `onChangeText` being called multiple times when changing the text programmatically in an input with the `multiline` prop set as true.

This PR reverts that partially, as the `maxLength` check is not being evaluated correctly before setting the text. Not reverting it completely as when removing the second part of the fix, the `onChangeText` gets called multiple times again.

## Changelog:

[IOS] [FIXED] - Fixing TextInput `maxLength` not working in old arch

Pull Request resolved: #48126

Test Plan:
The issue could be reproduced in the rn-tester. See my videos with the before and after the fix.

<details>
<summary>Before:</summary>

https://github.com/user-attachments/assets/86fd67eb-fc14-469a-a5f8-8e83b49f857c

</details>

<details>
<summary>After:</summary>

https://github.com/user-attachments/assets/368383b1-c1bd-4e0b-ac44-c78022462fa0

</details>

Reviewed By: cortinico

Differential Revision: D67025182

Pulled By: cipolleschi

fbshipit-source-id: 720c400eef362618106ae434aef421c7529214fe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextInput maximum length limit does not work in old architecture for iOS

4 participants