Skip to content

Commit

Permalink
Fix Increment and Decrement accessibility actions (#46617)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #46617

This changes fixes the Increment/Decrement accessibility actions on iOS with the New Architecture.

## Changelog
[iOS][Fixed] - Make sure that the Increment and Decrement accessibility actions works on iOS

Reviewed By: javache

Differential Revision: D63263830

fbshipit-source-id: 99dca14a002e098db2d3b0e268af32cdab6ce786
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Sep 24, 2024
1 parent a955164 commit 303e0ed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,20 @@ - (BOOL)accessibilityPerformEscape
}
}

- (void)accessibilityIncrement
{
if (_eventEmitter && _props->onAccessibilityAction) {
_eventEmitter->onAccessibilityAction("increment");
}
}

- (void)accessibilityDecrement
{
if (_eventEmitter && _props->onAccessibilityAction) {
_eventEmitter->onAccessibilityAction("decrement");
}
}

- (BOOL)didActivateAccessibilityCustomAction:(UIAccessibilityCustomAction *)action
{
if (_eventEmitter && _props->onAccessibilityAction) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ class FakeSliderExample extends React.Component<{}, FakeSliderExampleState> {
max: 100,
}}>
<Text style={{color: theme.SecondaryLabelColor}}>
Fake Slider
Fake Slider {this.state.current}
</Text>
</View>
<TouchableWithoutFeedback
Expand Down Expand Up @@ -1270,7 +1270,7 @@ class FakeSliderExample extends React.Component<{}, FakeSliderExampleState> {
accessibilityValue={{text: this.state.textualValue}}>
<View>
<Text style={{color: theme.SecondaryLabelColor}}>
Equalizer
Equalizer {this.state.textualValue}
</Text>
</View>
</TouchableWithoutFeedback>
Expand Down Expand Up @@ -1335,7 +1335,7 @@ class FakeSliderExampleForAccessibilityValue extends React.Component<
aria-valuetext={'slider aria value text'}
aria-valuenow={this.state.current}>
<Text style={{color: theme.SecondaryLabelColor}}>
Fake Slider
Fake Slider {this.state.current}
</Text>
</View>
<TouchableWithoutFeedback
Expand Down Expand Up @@ -1364,7 +1364,7 @@ class FakeSliderExampleForAccessibilityValue extends React.Component<
accessibilityValue={{text: this.state.textualValue}}>
<View>
<Text style={{color: theme.SecondaryLabelColor}}>
Equalizer
Equalizer {this.state.textualValue}
</Text>
</View>
</TouchableWithoutFeedback>
Expand Down

0 comments on commit 303e0ed

Please sign in to comment.