Parcourir la source

Add buttons accessibilityLabel support (#5844)

Co-authored-by: Guy Carmeli <guyca@users.noreply.github.com>
Yogev Ben David il y a 5 ans
Parent
révision
07c558c76f

+ 1
- 0
lib/ios/RNNNavigationButtons.m Voir le fichier

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

+ 4
- 0
lib/src/interfaces/Options.ts Voir le fichier

301
    * Set the button text
301
    * Set the button text
302
    */
302
    */
303
   text?: string;
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
    * Set the button font family
309
    * Set the button font family
306
    */
310
    */

+ 2
- 1
playground/src/screens/ButtonsScreen.js Voir le fichier

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