diff --git a/FlipToggle.js b/FlipToggle.js index 11f6f3e..954d5f6 100644 --- a/FlipToggle.js +++ b/FlipToggle.js @@ -28,6 +28,7 @@ class FlipToggle extends React.Component { offLabel: PropTypes.string, buttonOnColor: PropTypes.string, buttonOffColor: PropTypes.string, + accessibilityLabelComponent: PropTypes.string, disabledButtonOnColor: PropTypes.string, disabledButtonOffColor: PropTypes.string, sliderOnColor: PropTypes.string, @@ -58,6 +59,7 @@ class FlipToggle extends React.Component { disabledSliderOnColor: '#444', disabledSliderOffColor: '#444', labelStyle: {}, + accessibilityLabelComponent: '', buttonRadius: 0, sliderRadius: 0, labelStyle: { @@ -197,6 +199,11 @@ class FlipToggle extends React.Component { return ( ) : null} console.log(`toggle is ${this.state.isActive ? `on` : `off`}`)} onToggleLongPress={() => console.log('toggle long pressed!')} + accessibilityLabelComponent={PURPOSE_OF_TOGGLE_BUTTON} /> ``` ## API @@ -71,6 +72,7 @@ Then, use the FlipToggle component as shown below |sliderOffColor|'string'|no|'#dba628'|background color of the slider when it is off| |disabledSliderOnColor|'string'|no|'#444'|background color of the slider when the toggling is disabled but set at on| |disabledSliderOffColor|'string'|no|'#444'|background color of the slider when the toggling is disabled but set at off| +|accessibilityLabelComponent|'string'|no|''|purpose of the toggle button to be spoken by Talkback or Voice Over| ## Issues If you face any issues with implementing this component or have a feature request or queries, please create a new [issue](https://github.com/ashishpandey001/react-native-flip-toggle-button/issues).