-
Notifications
You must be signed in to change notification settings - Fork 25.1k
feat: add accessibilityLabelledBy props
#32470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
grgr-dkrk
wants to merge
6
commits into
facebook:main
from
grgr-dkrk:feat/add_accessibilityLabelledBy
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4b82094
feat: add accessibilityLabelledBy
grgr-dkrk 8f710ad
chore: fix lint error
grgr-dkrk ea3e774
chore: change findView from async to sync
grgr-dkrk 771ee40
chore: remove accessibilityLabelledBy props from Text
grgr-dkrk 11dc164
fix: Changed `accessibilityLabelledBy` to accept array as well
grgr-dkrk 1282770
fix: example for lint
grgr-dkrk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,7 @@ | |
| import com.facebook.react.bridge.WritableMap; | ||
| import com.facebook.react.uimanager.events.Event; | ||
| import com.facebook.react.uimanager.events.EventDispatcher; | ||
| import com.facebook.react.uimanager.util.ReactFindViewUtil; | ||
| import java.util.HashMap; | ||
|
|
||
| /** | ||
|
|
@@ -191,6 +192,8 @@ public void handleMessage(Message msg) { | |
| }; | ||
| } | ||
|
|
||
| @Nullable View mAccessibilityLabelledBy; | ||
|
|
||
| @Override | ||
| public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) { | ||
| super.onInitializeAccessibilityNodeInfo(host, info); | ||
|
|
@@ -200,6 +203,15 @@ public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCo | |
| setRole(info, accessibilityRole, host.getContext()); | ||
| } | ||
|
|
||
| final Object accessibilityLabelledBy = host.getTag(R.id.labelled_by); | ||
| if (accessibilityLabelledBy != null) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@@ -206,12 +206,11 @@
- ReactFindViewUtil.findView(
- host.getRootView(),
- new ReactFindViewUtil.OnViewFoundListener() {
- @Override
- public String getNativeId() {
- return (String) accessibilityLabelledBy;
- }
-
- @Override
- public void onViewFound(View view) {
- info.setLabeledBy(view);
- }
+ ReactFindViewUtil.findView(
+ host.getRootView(),
+ new ReactFindViewUtil.OnViewFoundListener() {
+ @Override
+ public String getNativeId() {
+ return (String) accessibilityLabelledBy;
+ }
+
+ @Override
+ public void onViewFound(View view) {
+ info.setLabeledBy(view); |
||
| mAccessibilityLabelledBy = | ||
| ReactFindViewUtil.findView(host.getRootView(), (String) accessibilityLabelledBy); | ||
| if (mAccessibilityLabelledBy != null) { | ||
| info.setLabeledBy(mAccessibilityLabelledBy); | ||
| } | ||
| } | ||
|
|
||
| // state is changeable. | ||
| final ReadableMap accessibilityState = (ReadableMap) host.getTag(R.id.accessibility_state); | ||
| if (accessibilityState != null) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
google-java-formatsuggested changes: