-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
View within text returns strange image - iOS 13 #26577
Comments
yes ,i also have this problem |
I searched a little through the react-native code and found that the strange image is the placeholder icon for an attachment in an NSAttributedString. RN seems to add attachments to the string to reserve some space and lay the real view on top of the rendered string. In RCTTextShadowView.m there is a function "attributedTextWithMeasuredAttachmentsThatFitSize" which creates the attachments by using the following code:
To verify that the image really is the placeholder image, I modified the code to add an empty image as the attachment image:
Using this code, RN stops rendering the document icons and the output looks as expected. Warning |
See facebook#26577 for the idea behind this change
I created a new pull-request where the image is only being created once for all attachments. This might be the way to go. |
I'm seeing the same thing on 0.60.5 and iOS 13 when there is a png or svg image inside a |
I created a new 0.61.1 project that can be used to reproduce the bug: At least React Native versions 0.59, 0.60, and 0.61 seem to be affected (possibly all RN versions). The bug can also be reproduced on my iPhone 8 device with iOS 13.1 installed. |
Also seeing this issue after updating my phone to IOS13 with RN0.58 app. @partiellkorrekt : can you place a link to the pull request here? (I need a solution to implement in a production ready app... this issue is really a last-minute p**n in the *ss for my project!) |
Summary: This fixes a bug reported by Oculus and OSS. #26577 When rendering images nested in a `<Text/>` node, on the native side, `RCTTextShadowView` adds an empty NSTextAttachment to the attributed string to add some extra space. The image is then overlaid in the empty space . This all works fine and dandy on iOS12 and below. Starting in iOS13, an empty NSTextAttachment doesn't render as blank space. It renders as the "missing image" white page. When the real image is overlaid on the white page, it looks super broken. See github issue and test plan for examples. This fix is to assign an empty image to `NSTextAttachment`. I tried seeing if there was any other attribute we could use to just add white space to an attributed string, but this seems like the best one. Changelog: [iOS][Fixed] Fixed bug rendering nested text on iOS13 Reviewed By: xyin96 Differential Revision: D18048277 fbshipit-source-id: 711cee96934fc1937d694621a4417c152dde3a31
This commit fixes this issue :) |
Summary: This fixes a bug reported by Oculus and OSS. #26577 When rendering images nested in a `<Text/>` node, on the native side, `RCTTextShadowView` adds an empty NSTextAttachment to the attributed string to add some extra space. The image is then overlaid in the empty space . This all works fine and dandy on iOS12 and below. Starting in iOS13, an empty NSTextAttachment doesn't render as blank space. It renders as the "missing image" white page. When the real image is overlaid on the white page, it looks super broken. See github issue and test plan for examples. This fix is to assign an empty image to `NSTextAttachment`. I tried seeing if there was any other attribute we could use to just add white space to an attributed string, but this seems like the best one. Changelog: [iOS][Fixed] Fixed bug rendering nested text on iOS13 Reviewed By: xyin96 Differential Revision: D18048277 fbshipit-source-id: 711cee96934fc1937d694621a4417c152dde3a31
Summary: This fixes a bug reported by Oculus and OSS. facebook/react-native#26577 When rendering images nested in a `<Text/>` node, on the native side, `RCTTextShadowView` adds an empty NSTextAttachment to the attributed string to add some extra space. The image is then overlaid in the empty space . This all works fine and dandy on iOS12 and below. Starting in iOS13, an empty NSTextAttachment doesn't render as blank space. It renders as the "missing image" white page. When the real image is overlaid on the white page, it looks super broken. See github issue and test plan for examples. This fix is to assign an empty image to `NSTextAttachment`. I tried seeing if there was any other attribute we could use to just add white space to an attributed string, but this seems like the best one. Changelog: [iOS][Fixed] Fixed bug rendering nested text on iOS13 Reviewed By: xyin96 Differential Revision: D18048277 fbshipit-source-id: 711cee96934fc1937d694621a4417c152dde3a31
Summary: This fixes a bug reported by Oculus and OSS. facebook#26577 When rendering images nested in a `<Text/>` node, on the native side, `RCTTextShadowView` adds an empty NSTextAttachment to the attributed string to add some extra space. The image is then overlaid in the empty space . This all works fine and dandy on iOS12 and below. Starting in iOS13, an empty NSTextAttachment doesn't render as blank space. It renders as the "missing image" white page. When the real image is overlaid on the white page, it looks super broken. See github issue and test plan for examples. This fix is to assign an empty image to `NSTextAttachment`. I tried seeing if there was any other attribute we could use to just add white space to an attributed string, but this seems like the best one. Changelog: [iOS][Fixed] Fixed bug rendering nested text on iOS13 Reviewed By: xyin96 Differential Revision: D18048277 fbshipit-source-id: 711cee96934fc1937d694621a4417c152dde3a31
Summary: This fixes a bug reported by Oculus and OSS. facebook#26577 When rendering images nested in a `<Text/>` node, on the native side, `RCTTextShadowView` adds an empty NSTextAttachment to the attributed string to add some extra space. The image is then overlaid in the empty space . This all works fine and dandy on iOS12 and below. Starting in iOS13, an empty NSTextAttachment doesn't render as blank space. It renders as the "missing image" white page. When the real image is overlaid on the white page, it looks super broken. See github issue and test plan for examples. This fix is to assign an empty image to `NSTextAttachment`. I tried seeing if there was any other attribute we could use to just add white space to an attributed string, but this seems like the best one. Changelog: [iOS][Fixed] Fixed bug rendering nested text on iOS13 Reviewed By: xyin96 Differential Revision: D18048277 fbshipit-source-id: 711cee96934fc1937d694621a4417c152dde3a31
React Native version: 0.61.1 | 0.60.5
Steps To Reproduce
<View>
within<Text>
generate a weird behavior..<Text><Image /></Text>
like a:It returns a strange image behind the image after upgrade to iOS 13.
Screenshots
The text was updated successfully, but these errors were encountered: