Android: Fix handling of line height with inline images
Summary: This PR was split from a commit originally in #8619. /cc dmmiller When an inline image was larger than the specified line height, the image would be clipped. This changes the behavior so that the line height is changed to make room for the inline image. This is consistent with the behavior of RN for iOS. Here's how the change works. ReactTextView now receives its line height from the layout thread rather than directly from JavaScript. The reason is that the layout thread may pick a different line height. In the case that the tallest inline image is larger than the line height supplied by JavaScript, we want to use that image's height as the line height rather than the supplied line height. Also fixed a bug where the image, which is supposed to be baseline aligned, would be positioned at the wrong y location. To fix this, we use `y` (the baseline) in the `draw` method rather than trying to calculate the baseline from `bottom`. For more information see https://code.google.com/p/andro Closes https://github.com/facebook/react-native/pull/8907 Differential Revision: D3592781 Pulled By: dmmiller fbshipit-source-id: cba6cd86eb4e3abef6a0d7a81f802bdb0958492e
Showing
- ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java 32 additions, 16 deletions...va/com/facebook/react/views/text/ReactTextShadowNode.java
- ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextUpdate.java 8 additions, 1 deletion...n/java/com/facebook/react/views/text/ReactTextUpdate.java
- ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java 12 additions, 0 deletions...ain/java/com/facebook/react/views/text/ReactTextView.java
- ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java 0 additions, 9 deletions...a/com/facebook/react/views/text/ReactTextViewManager.java
- ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineImageSpan.java 10 additions, 0 deletions...va/com/facebook/react/views/text/TextInlineImageSpan.java
- ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageSpan.java 11 additions, 3 deletions...xt/frescosupport/FrescoBasedReactTextInlineImageSpan.java
- ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java 1 addition, 1 deletion...ebook/react/views/textinput/ReactTextInputShadowNode.java
Please register or sign in to comment