react-native/React/Modules
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
..
RCTAccessibilityManager.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTAccessibilityManager.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTAlertManager.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTAlertManager.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTAppState.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTAppState.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTAsyncLocalStorage.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTAsyncLocalStorage.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTClipboard.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTClipboard.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTDevSettings.h iOS changes to switch to JSI 2018-10-18 01:06:24 -07:00
RCTDevSettings.mm iOS changes to switch to JSI 2018-10-18 01:06:24 -07:00
RCTDeviceInfo.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTDeviceInfo.m Making RCTIsIPhoneX() return true for the R and Max models 2018-09-16 21:46:50 -07:00
RCTEventEmitter.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTEventEmitter.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTExceptionsManager.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTExceptionsManager.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTI18nManager.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTI18nManager.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTI18nUtil.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTI18nUtil.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTKeyboardObserver.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTKeyboardObserver.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTLayoutAnimation.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTLayoutAnimation.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTLayoutAnimationGroup.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTLayoutAnimationGroup.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTRedBox.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTRedBox.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTRedBoxExtraDataViewController.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTRedBoxExtraDataViewController.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTSourceCode.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTSourceCode.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTStatusBarManager.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTStatusBarManager.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTTVNavigationEventEmitter.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTTVNavigationEventEmitter.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTTiming.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTTiming.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTUIManager.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTUIManager.m iOS: Support inline view truncation (#21456) 2018-11-20 00:11:56 -08:00
RCTUIManagerObserverCoordinator.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTUIManagerObserverCoordinator.mm Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTUIManagerUtils.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTUIManagerUtils.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00