Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: https://github.com/facebook/react-native/blob/1e2a924ba60001c6f0587c7561536f00b2922cbf/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: #21456 Differential Revision: D10182991 Pulled By: shergin fbshipit-source-id: a5bddddb1bb8672b61d4feaa04013a92c8224155
- Loading branch information