Permalink
Browse files

changed prop name currentViewStates to AccessibilityStates on iOS (3/3)

Summary:
Context:
After discussing with yungsters, `currentViewStates` is a very ambiguous name for a prop, especially because there are only two possible values. From a developer's perspective, it makes more sense to just call them `accessibilityStates` because the main use for them is to add states to Talkback and Voiceover.
Also, the actual implementation of what we're changing under the hood in Native Code is abstracted away from developers using React Native, so as long as behavior is as they would expect, it makes more sense to change the name into a clear one.

Changes in this Diff:
Renamed the view property exposed to native iOS code from `currentViewStates`  to `accessibilityStates`
Also deleted setting the userInteractionEnabled view property, because we want to keep it as just an accessibility property.

Reviewed By: PeteTheHeat

Differential Revision: D8896821

fbshipit-source-id: 95674c9b7295f5b9e60994c297acdee83f6226d7
  • Loading branch information...
ziqichen6 authored and facebook-github-bot committed Jul 19, 2018
1 parent 3bedc78 commit ca01290d8e8fe73494f317ed9f81d339e65fdea0
Showing with 2 additions and 7 deletions.
  1. +2 −7 React/Views/RCTViewManager.m
@@ -153,14 +153,9 @@ - (RCTShadowView *)shadowView
view.reactAccessibilityElement.accessibilityTraits |= json ? [RCTConvert UIAccessibilityTraits:json] : defaultView.accessibilityTraits;
}
RCT_CUSTOM_VIEW_PROPERTY(currentViewStates, UIAccessibilityTraits, RCTView)
RCT_CUSTOM_VIEW_PROPERTY(accessibilityStates, UIAccessibilityTraits, RCTView)
{
UIAccessibilityTraits traits = json ? [RCTConvert UIAccessibilityTraits:json] : defaultView.accessibilityTraits;
view.reactAccessibilityElement.accessibilityTraits |= traits;
if (traits == UIAccessibilityTraitNotEnabled || traits == (UIAccessibilityTraitNotEnabled | UIAccessibilityTraitSelected))
{
view.userInteractionEnabled = NO;
}
view.reactAccessibilityElement.accessibilityTraits |= json ? [RCTConvert UIAccessibilityTraits:json] : defaultView.accessibilityTraits;
}
RCT_CUSTOM_VIEW_PROPERTY(pointerEvents, RCTPointerEvents, RCTView)

0 comments on commit ca01290

Please sign in to comment.