react-native icon indicating copy to clipboard operation
react-native copied to clipboard

fix: get all bytes from the text in native event key in fabric

Open deepanshushuklad11 opened this issue 1 year ago • 3 comments

Summary:

Fixes https://github.com/facebook/react-native/issues/45199.

Problem was whenever you type in TextInput onKeypress callback called and event key was returned as keyPressMetrics.text.front(); which basically fetch the first byte from text . But in case of non-ascii character text is coming like ' \804'(in octal) which means first byte was empty string . So solution was the return whole text as it is i.e. keyPressMetrics.text

Changelog:

[IOS][FIXED] - nativeEvent key returning empty in case any non-ascii character entered , in IOS fabric

For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests -->

Test Plan:

Below are the screenrecording for solution in new arch

https://github.com/facebook/react-native/assets/111736628/ea9034d3-3105-44e2-9998-4264d218ab93

deepanshushuklad11 avatar Jul 04 '24 07:07 deepanshushuklad11

Hi @deepanshushuklad11!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

facebook-github-bot avatar Jul 04 '24 07:07 facebook-github-bot

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

facebook-github-bot avatar Jul 04 '24 08:07 facebook-github-bot

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 20,317,001 -968,111
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 23,513,647 -968,212
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 261f82e897d34196d743d8f81bcae7fd79831643 Branch: main

analysis-bot avatar Jul 04 '24 08:07 analysis-bot

Thanks @arushikesarwani94 .I will look in to it . Also can you explain more about The problem is also entering non ASCII character (é) is being registered as onChange event instead of onKeyPress

deepanshushuklad11 avatar Jul 05 '24 17:07 deepanshushuklad11

Also can you explain more about The problem is also entering non ASCII character (é) is being registered as onChange event instead of onKeyPress

What I mean by that is upon entering accented letters é (Long press e to select é) that doesn't trigger as a onKeyPress instead fires up as a onChange event which is why the characters aren't showing up.

However your fix does address the non-ASCII characters when they are typed in directly from keyboard like (keyboard combo of Opt + Shift + Y produces Á, Opt + Shift + K produces )

arushikesarwani94 avatar Jul 05 '24 19:07 arushikesarwani94

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

facebook-github-bot avatar Jul 05 '24 19:07 facebook-github-bot

@arushikesarwani94 merged this pull request in facebook/react-native@820a88418cdb6f5249b5ded20dcec4b4780cd07f.

facebook-github-bot avatar Jul 05 '24 22:07 facebook-github-bot

This pull request was successfully merged by @deepanshushuklad11 in 820a88418cdb6f5249b5ded20dcec4b4780cd07f.

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

github-actions[bot] avatar Jul 05 '24 22:07 github-actions[bot]