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

defaultTextProps style overwrites renderers #650

Open
10 of 15 tasks
VNDRN opened this issue Nov 27, 2023 · 1 comment
Open
10 of 15 tasks

defaultTextProps style overwrites renderers #650

VNDRN opened this issue Nov 27, 2023 · 1 comment
Labels
bug Crush'em all.

Comments

@VNDRN
Copy link

VNDRN commented Nov 27, 2023

Decision Table

  • My issue does not look like “The HTML attribute 'xxx' is ignored” (unless we claim support for it)
  • My issue does not look like “The HTML element <yyy> is not rendered”

Good Faith Declaration

Description

defaultTextProps overwrites customrenderers style. The provided snack is a minimal reproduction. I believe it should be the other way around (as defaultTextProps should be default & overwritable?)

My main issue is: I should be able to add custom fontFamilies to em and strong tags, if they are nested like this:

strongFont
italicFont
strongItalicFont

this is possible with customrenderers, but I can't provide a default style/font for eg: p tags...
I tried to set defaultStyles with tagStyles, but those also overwrite the customrenderers (and it's not possible to see if the tag is nested)

Any solution to this problem or help is much appreciated?

React Native Information

confer snack

RNRH Version

6.3.4

Tested Platforms

  • Android
  • iOS
  • Web
  • MacOS
  • Windows

Reproduction Platforms

  • Android
  • iOS
  • Web
  • MacOS
  • Windows

Minimal, Reproducible Example

https://snack.expo.dev/@upgradeestate/rnrhtml-template

const Demo = ()=>{
  const demoRenderer = useMemo(
    () => ({
      strong: ({ TDefaultRenderer, ...props }) => (
        <TDefaultRenderer {...props} style={{ color: 'red' }} />
      ),
    }),
    [],
  );

  return (
    <RenderHTML
      systemFonts={systemFonts}
      renderers={demoRenderer}
      defaultTextProps={{ style: { color: 'blue' } }}
      source={{ html: `<strong>this should be red</strong>` }}
    />
  );
}

Additional Notes

If this is incorrectly formatted or my question was answered somewhere else, please let me know!

@VNDRN VNDRN added the bug Crush'em all. label Nov 27, 2023
@RuslanAktaev
Copy link

RuslanAktaev commented Jan 8, 2024

@VNDRN same issue with selectable: false/false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Crush'em all.
Projects
None yet
Development

No branches or pull requests

2 participants