Skip to content

Commit

Permalink
fix: get all bytes from the text in native event key in fabric (#45274)
Browse files Browse the repository at this point in the history
Summary:
Fixes #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

Pull Request resolved: #45274

Test Plan:
Below are the screenrecording for solution in new arch

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

Reviewed By: NickGerleman

Differential Revision: D59405313

Pulled By: arushikesarwani94

fbshipit-source-id: 65e153b933f345e3ec66a691aa8a4ab15d651440
  • Loading branch information
deepanshushuklad11 authored and facebook-github-bot committed Jul 5, 2024
1 parent 85dc2e3 commit 820a884
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static jsi::Value keyPressMetricsPayload(
} else if (keyPressMetrics.text.front() == '\t') {
key = "Tab";
} else {
key = keyPressMetrics.text.front();
key = keyPressMetrics.text;
}
}
payload.setProperty(
Expand Down

0 comments on commit 820a884

Please sign in to comment.