react-native-macos/Libraries
Adam Comella 70826dbafc iOS: Support inline view truncation (#21456)
Summary:
If text is truncated and an inline view appears after the truncation point, the user should not see the inline view. Instead, we have a bug such that the inline view is always visible at the end of the visible text.

This commit fixes this by marking the inline view as hidden if it appears after the truncation point.

This appears to be a regression. React Native used to have logic similar to what this commit is adding: 1e2a924ba6/Libraries/Text/RCTShadowText.m (L186-L192)

**Before fix**

Inline view (blue square) is visible even though it appears after the truncation point:

![image](https://user-images.githubusercontent.com/199935/46382038-d3a71200-c65d-11e8-8179-2ce4aad8d010.png)

The full text being rendered was:

```
<Text numberOfLines={1}>
  Lorem ipsum dolor sit amet, consectetur adipiscing elit,
  sed do eiusmod tempor incididunt ut labore et dolore magna
  <View style={{width: 50, height: 50, backgroundColor: 'steelblue'}} />
</Text>
```

**After fix**

Inline view is properly truncated:

![image](https://user-images.githubusercontent.com/199935/46382067-fdf8cf80-c65d-11e8-84ea-e2b71c229dae.png)

**Test Plan**

Tested that the inline view is hidden if it appears after the truncation point when `numberOfLines` is 1 and 2. Similarly, verified that the inline view is visible if it appears before the truncation point.

**Release Notes**

[IOS] [BUGFIX] [Text] - Fix case where inline view is visible even though it should have been truncated

Adam Comella
Microsoft Corp.
Pull Request resolved: https://github.com/facebook/react-native/pull/21456

Differential Revision: D10182991

Pulled By: shergin

fbshipit-source-id: a5bddddb1bb8672b61d4feaa04013a92c8224155
2018-11-20 00:11:56 -08:00
..
ART Flow strictifying AdsManagerAudienceImages.js 2018-11-01 09:52:41 -07:00
ActionSheetIOS Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
Alert Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
Animated Flow v0.86.0 in xplat/js 2018-11-16 10:43:16 -08:00
AppState Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
BatchedBridge Change new Date() to Date.now() to save on date allocations 2018-09-21 11:11:33 -07:00
Blob Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
BugReporting Remove explicit requires of Map and Set 2018-10-19 10:57:24 -07:00
CameraRoll Changed front-facing camera so that it shows consistent image during capture and preview 2018-11-15 16:28:03 -08:00
Color Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
Components Remove useless additionnal blur call (#22156) 2018-11-19 18:53:56 -08:00
Core Use nativeQPLTimestamp for InitializeCore marker point 2018-11-09 14:14:40 -08:00
DeprecatedPropTypes Move createStrictShapeTypeChecker to deprecated 2018-10-12 15:17:02 -07:00
EventEmitter Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
Experimental Fix inline styles warning in Libraries (#22161) 2018-11-06 14:32:43 -08:00
Geolocation Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
Image Increase cache and file size limits 2018-11-05 05:40:35 -08:00
Inspector Remove unused styles (#22083) 2018-11-05 13:57:47 -08:00
Interaction Remove explicit requires of Map and Set 2018-10-19 10:57:24 -07:00
JSInspector Remove explicit requires of Map and Set 2018-10-19 10:57:24 -07:00
LayoutAnimation RN: Remove Prop Types from `LayoutAnimation` 2018-09-28 01:07:45 -07:00
Linking Normalize scheme for URL on Android (#21561) 2018-10-09 23:32:24 -07:00
LinkingIOS Update RCTLinkingManager.h to explicitly state the 'nullability' of parameters (#20798) 2018-09-21 06:18:39 -07:00
Lists Fix inline styles warning in Libraries (#22161) 2018-11-06 14:32:43 -08:00
Modal Improving Modal `visible` prop check to handle undefined and null (#22072) 2018-11-03 18:44:53 -07:00
NativeAnimation fix broken animation tests 2018-09-28 09:17:17 -07:00
Network NetInfo: try to solve crash with releasing _firstTimeReachability 2018-11-12 10:45:34 -08:00
Performance Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
PermissionsAndroid Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
PushNotificationIOS Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTTest RN: Missing Copyright Headers 2018-10-31 01:37:26 -07:00
ReactNative Flow v0.86.0 in xplat/js 2018-11-16 10:43:16 -08:00
Renderer React sync for revisions 4773fdf...3ff2c7c 2018-11-07 19:36:04 -08:00
Sample RN: Missing Copyright Headers 2018-10-31 01:37:26 -07:00
Settings Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
Share Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
Storage Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
StyleSheet Fix regression in StyleSheet.setStyleAttributePreprocessor (#22262) 2018-11-13 23:38:01 -08:00
SurfaceBackedComponent Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
SurfaceHostingComponent Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
Text iOS: Support inline view truncation (#21456) 2018-11-20 00:11:56 -08:00
Types Fix internal flow problems 2018-09-27 14:18:31 -07:00
Utilities Back out "reapply TextInput es6 conversion with fixes, attemps to fix" 2018-11-16 14:50:23 -08:00
Vibration Add deprecation warnings for a few IOS components 2018-10-22 23:17:13 -07:00
WebSocket Fix duplicate function declaration in WebSockets (#22098) 2018-11-03 18:41:24 -07:00
Wrapper Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
YellowBox Fix View/Text displayName (#21950) 2018-10-29 12:42:10 -07:00
fishhook Merge fishhook.xcodeproj in RCTWebSocket 2017-08-09 07:48:09 -07:00
polyfills console polyfill: pass unsupported messages to original console 2018-11-07 11:21:55 -08:00
react-native Add back removal notice of BackAndroid 2018-10-22 11:46:03 -07:00
vendor Remove var in Libraries/vendor/core/merge.js (#22108) 2018-11-04 10:55:37 -08:00
.npmignore npmignore: ignore tests and fixtures 2018-02-27 08:42:14 -08:00
Promise.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
UTFSequence.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
promiseRejectionIsError.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00