@@ -23,6 +23,7 @@ const {
23
23
Alert,
24
24
StyleSheet,
25
25
Slider,
26
+ Picker,
26
27
Platform,
27
28
} = require ( 'react-native' ) ;
28
29
import type { EventSubscription } from 'react-native/Libraries/vendor/emitter/EventEmitter' ;
@@ -664,7 +665,7 @@ class AccessibilityActionsExample extends React.Component<{}> {
664
665
</ View >
665
666
</ RNTesterBlock >
666
667
667
- < RNTesterBlock title = "Button with custom accessibility actions" >
668
+ < RNTesterBlock title = "TouchableWithoutFeedback with custom accessibility actions" >
668
669
< TouchableWithoutFeedback
669
670
accessible = { true }
670
671
accessibilityActions = { [
@@ -692,6 +693,70 @@ class AccessibilityActionsExample extends React.Component<{}> {
692
693
</ View >
693
694
</ TouchableWithoutFeedback >
694
695
</ RNTesterBlock >
696
+
697
+ < RNTesterBlock title = "Button with accessibility actions" >
698
+ < Button
699
+ accessible = { true }
700
+ accessibilityActions = { [
701
+ { name : 'activate' , label : 'activate label' } ,
702
+ { name : 'copy' , label : 'copy label' } ,
703
+ ] }
704
+ onAccessibilityAction = { event => {
705
+ switch ( event . nativeEvent . actionName ) {
706
+ case 'activate' :
707
+ Alert . alert ( 'Alert' , 'Activate accessiblity action' ) ;
708
+ break ;
709
+ case 'copy' :
710
+ Alert . alert ( 'Alert' , 'copy action success' ) ;
711
+ break ;
712
+ }
713
+ } }
714
+ onPress = { ( ) => Alert . alert ( 'Button has been pressed!' ) }
715
+ title = "Button with accessiblity action"
716
+ />
717
+ </ RNTesterBlock >
718
+
719
+ < RNTesterBlock title = "Text with custom accessibility actions" >
720
+ < Text
721
+ accessible = { true }
722
+ accessibilityActions = { [
723
+ { name : 'activate' , label : 'activate label' } ,
724
+ { name : 'copy' , label : 'copy label' } ,
725
+ ] }
726
+ onAccessibilityAction = { event => {
727
+ switch ( event . nativeEvent . actionName ) {
728
+ case 'activate' :
729
+ Alert . alert ( 'Alert' , 'Activate accessiblity action' ) ;
730
+ break ;
731
+ case 'copy' :
732
+ Alert . alert ( 'Alert' , 'copy action success' ) ;
733
+ break ;
734
+ }
735
+ } } >
736
+ Text
737
+ </ Text >
738
+ </ RNTesterBlock >
739
+
740
+ < RNTesterBlock title = "Picker with accessibility actions" >
741
+ < Picker
742
+ accessible = { true }
743
+ accessibilityActions = { [
744
+ { name : 'activate' , label : 'activate label' } ,
745
+ { name : 'copy' , label : 'copy label' } ,
746
+ ] }
747
+ onAccessibilityAction = { event => {
748
+ switch ( event . nativeEvent . actionName ) {
749
+ case 'activate' :
750
+ Alert . alert ( 'Alert' , 'Activate accessiblity action' ) ;
751
+ break ;
752
+ case 'copy' :
753
+ Alert . alert ( 'Alert' , 'copy action success' ) ;
754
+ break ;
755
+ }
756
+ } } >
757
+ < Picker . Item label = "Item 1" value = "item1" />
758
+ </ Picker >
759
+ </ RNTesterBlock >
695
760
</ View >
696
761
) ;
697
762
}
0 commit comments