Skip to content
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

Warning when passing tagStyles to p, h1, h2, h3, etc. wrapping an img tag #150

Closed
wpalahnuk opened this issue May 16, 2018 · 3 comments
Closed
Labels
bug:minor Low priority bug. bug Crush'em all. is:help wanted We are welcoming PRs to address this.

Comments

@wpalahnuk
Copy link

wpalahnuk commented May 16, 2018

Is this a bug report or a feature request?

Bug report

Have you read the guidelines regarding bug report?

Yes

Have you read the documentation in its entirety?

Yes

Have you made sure that your issue hasn't already been reported/solved?

Yes

Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?

Android 8.0 (API level 26)
Unsure about iOS

Is the bug reproductible in a production environment (not a debug one)?

Unsure

Have you been able to reproduce the bug in the provided example?

Yes, in this file: https://github.com/archriss/react-native-render-html/blob/master/Demo/src/snippets.js

Change:

imagesWithinParagraphs: { name: 'Images within paragraphs' },

To this:

imagesWithinParagraphs: { name: 'Images within paragraphs', 
    props: { 
        tagsStyles: {
            p: { fontSize: 10 }
        }
    } 
},

You will see the error: Warning: Failed prop type: Invalid props.style key fontSize supplied to View.

I find similar issues with img tags wrapped in h1, h2, h3, etc. tags

Environment

Environment:
React: 16.3.1
React native: 0.55.0
react-native-render-html: 3.10.0

Target Platform:
Android (6.0)
iOS (10.3)

Steps to Reproduce

In this file: https://github.com/archriss/react-native-render-html/blob/master/Demo/src/snippets.js

Change:

imagesWithinParagraphs: { name: 'Images within paragraphs' },

To this:

imagesWithinParagraphs: { name: 'Images within paragraphs', 
    props: { 
        tagsStyles: {
            p: { fontSize: 10 }
        }
    } 
},

Expected Behavior

No warning

Actual Behavior

A warning is being shown:
Warning: Failed prop type: Invalid props.style key fontSize supplied to View.

Reproducible Demo

In this file: https://github.com/archriss/react-native-render-html/blob/master/Demo/src/snippets.js

Change:

imagesWithinParagraphs: { name: 'Images within paragraphs' },

To this:

imagesWithinParagraphs: { name: 'Images within paragraphs', 
    props: { 
        tagsStyles: {
            p: { fontSize: 10 }
        }
    } 
},
@Exilz Exilz added is:help wanted We are welcoming PRs to address this. bug:minor Low priority bug. labels Jun 7, 2018
@Exilz
Copy link
Contributor

Exilz commented Jun 7, 2018

This is due to the most recent code which handles styles inheritance in text elements. There should be a logic which prevents non-text styling to be passed down all the way to texts.

If anyone wants to look into this, I'll gladly review a pull request. Anyway, this shouldn't be a breaking bug.

@jsamr
Copy link
Collaborator

jsamr commented Nov 26, 2020

This is fixed in the Foundry release, you can try it out now! See #434.

@jsamr
Copy link
Collaborator

jsamr commented Jun 8, 2021

Closing now since the stable beta which fixes this issue has just been released.

@jsamr jsamr closed this as completed Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:minor Low priority bug. bug Crush'em all. is:help wanted We are welcoming PRs to address this.
Projects
None yet
Development

No branches or pull requests

3 participants