feat(text-input): [iOS] inputAccessoryViewButtonLabel
prop
#47441
+65
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Fixes #29244, also mentioned in #25009
As mentioned in the linked issues, the current return key label in the input accessory view is not localized. In the code, right now the texts are hardcoded (see: RCTTextInputComponentView.mm and RCTBaseTextInputView.mm). I could not find the historical reason for this, but doing some investigation there doesn't seem to be a way of getting the translated text into the code by using the existing props. (Ref: https://stackoverflow.com/a/58190342/5415299)
The solution: adding a new property
inputAccessoryViewButtonLabel
which can be used to overwrite these defaults non-translated values. The property is optional to avoid breaking changes.The implementation works for both Fabric and Paper.
Changelog:
[IOS] [ADDED] - TextInput
inputAccessoryViewButtonLabel
propTest Plan:
A new example has been added under the
TextInput
examples in the RNTester. See below:Video demonstrating how the new prop behaves
Screen.Recording.2024-11-05.at.23.04.24.mov