Commit Graph

3 Commits

Author SHA1 Message Date
Joshua Alvarado 915a020fca Proper support of the accessibilityLabel for <Text> components on iOS
Summary:
**PR changes**
The RCTText class originally overrode the accessibilityLabel and returned the raw text of the class ignoring if the accessibilityLabel was set explicitly in code.
Example:
  <Text accessibilityLabel="Example"> Hello World </Text> // returns "Hello World" instead of "Example" for the accessibility label

My update checks if the super's accessibilityLabel is not nil and returns the value else it returns the raw text itself as a default to mirror what a UIKit's UILabel does. The super's accessibilityLabel is nil if the accessibilityLabel is not ever set in code. I don't check the length of the label because if the value was set to an empty purposely then it will respect that and return whatever was set in code.
With the new changes:
  <Text accessibilityLabel="Example"> Hello World </Text> // returns "Example" for the accessibilityLabel

This change doesn't support nested <Text> components with both accessibilityLabel's value set respectively. The parent's value will return.
Example:

  // returns "Example" instead of "Example Test" for the accessibility label
  <Text accessibilityLabel="Example">
    Hello
    <Text accessibilityLabel="Test">
      World
    </Text>
  </Text>

The workaround is just to set the only the parent view's accessibilityLabel with the label desired for it and all its nested views or just not nest the views if possible.
I believe a bigger change would be needed to support accessibility for nested views, for now the changes I have made should satisfy the requirements.

Reviewed By: shergin

Differential Revision: D5806097

fbshipit-source-id: aef2d7cec4657317fcd7dd557448905e4b767f1a
2017-09-12 12:53:59 -07:00
Caleb Meredith 90eaeb019b Upgrade fbsource/xplat/js to Flow v0.53.0
Reviewed By: avikchaudhuri

Differential Revision:
D5648819
Ninja: T20988071

fbshipit-source-id: 66e5b6747c79ae66b6eb69d40ede5e982c26174f
2017-08-17 18:45:01 -07:00
Eric Vicenti 4a80dceac7 Re-license and rename UIExplorer integration test app as RNTester
Reviewed By: yungsters

Differential Revision: D4950085

fbshipit-source-id: 44574b5d0ef0d2ad5dfc714309b18dc69cbad9ff
2017-05-08 11:31:19 -07:00