fix: get all bytes from the text in native event key in fabric (#45274)

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

Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Deepanshu.shukla
2024-07-05 15:38:00 -07:00
committed by Facebook GitHub Bot
parent 85dc2e393f
commit 820a88418c
@@ -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(