Browse Source

Add buttons accessibilityLabel support (#5844)

Co-authored-by: Guy Carmeli <guyca@users.noreply.github.com>
Yogev Ben David 4 years ago
parent
commit
07c558c76f

+ 1
- 0
lib/ios/RNNNavigationButtons.m View File

@@ -160,6 +160,7 @@
160 160
         return nil;
161 161
     }
162 162
     
163
+    barButtonItem.accessibilityLabel = dictionary[@"accessibilityLabel"];
163 164
     barButtonItem.target = self.viewController;
164 165
     barButtonItem.action = @selector(onButtonPress:);
165 166
     

+ 4
- 0
lib/src/interfaces/Options.ts View File

@@ -301,6 +301,10 @@ export interface OptionsTopBarButton {
301 301
    * Set the button text
302 302
    */
303 303
   text?: string;
304
+  /**
305
+   * Overrides the text that's read by the screen reader when the user interacts with the element
306
+   */
307
+  accessibilityLabel?: string;
304 308
   /**
305 309
    * Set the button font family
306 310
    */

+ 2
- 1
playground/src/screens/ButtonsScreen.js View File

@@ -53,7 +53,8 @@ class Options extends Component {
53 53
             id: 'LEFT',
54 54
             testID: LEFT_BUTTON,
55 55
             icon: require('../../img/clear.png'),
56
-            color: Colors.primary
56
+            color: Colors.primary,
57
+            accessibilityLabel: 'Close button'
57 58
           }
58 59
         ]
59 60
       }