react-native/React
Adam Comella 35338e9008 iOS: Avoid adding extra spaces to accessibility label
Summary:
In some cases, `RCTRecursiveAccessibilityLabel` could return an accessibility label that had leading space, trailing space, or multiple spaces between words. This is because it always added a space before adding a label even if the label turned out to be empty.

This is fixed by being stricter about adding spaces.

Found test cases that used to introduce leading space, trailing space, or multiple spaces between words and verified that there aren't any extra spaces after the fix.

```
{/* Used to have leading space */}
<View accessible={true}>
  <View />
  <View accessibilityLabel='Two' />
  <View accessibilityLabel='Three' />
</View>

{/* Used to have 2 spaces between "One" and "Three" */}
<View accessible={true}>
  <View accessibilityLabel='One' />
  <View />
  <View accessibilityLabel='Three' />
</View>

{/* Used to have trailing space */}
<View accessible={true}>
  <View accessibilityLabel='One' />
  <View accessibilityLabel='Two' />
  <View />
</View>
```

Additionally, my team is using this fix in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14177

Differential Revision: D5127891

Pulled By: shergin

fbshipit-source-id: 42c3022895d844959e0037eaf381b326af3cd6d1
2017-05-24 23:15:41 -07:00
..
Base Fix data race on read/write _instance variable in ModuleData class 2017-05-24 13:01:00 -07:00
CxxBridge Provide sync vs async interface for bundle loading via parameter 2017-05-24 07:31:36 -07:00
CxxModule Improve systrace markers 2017-05-12 18:07:49 -07:00
CxxUtils Explicitly cast to (bool) where needed on objc with folly::dynamic 2017-04-18 15:36:20 -07:00
DevSupport Fix packager reload command not working 2017-05-15 10:30:36 -07:00
Executors Remove RCTBatchedBridge rule and all uses from the tree 2017-04-19 17:00:43 -07:00
Modules Introducing `-[RCTUIManager shadowViewForReactTag:]` 2017-05-16 09:46:53 -07:00
Profiler Fix memory leak in RN fbsystrace support 2017-05-15 03:47:15 -07:00
React.xcodeproj Move packager launcher scripts outside of `packager/` 2017-05-23 16:17:09 -07:00
ReactLegacy.xcodeproj Move packager launcher scripts outside of `packager/` 2017-05-23 16:17:09 -07:00
Views iOS: Avoid adding extra spaces to accessibility label 2017-05-24 23:15:41 -07:00
third-party.xcconfig More attempts to fix Travis CI runs 2017-05-10 04:32:54 -07:00