meliorence / react-native-render-html

iOS/Android pure javascript react-native component that renders your HTML into 100% native views
https://meliorence.github.io/react-native-render-html/
BSD 2-Clause "Simplified" License
3.48k stars 589 forks source link

using inline css is okay but when specify class for element then it's not work as i expected #542

Closed isekaimaou1109 closed 2 years ago

isekaimaou1109 commented 2 years ago
import { useWindowDimensions } from 'react-native';
import RenderHtml from 'react-native-render-html';

export default function App() {
  const source = {
    html: `
      <html>
        <head>
          <title>Title</title>
          <style>
            .demo {
              color: red;
              text-align: center;
            }
          </style>
        </head>

        <body>
          <p class='demo'>
            Hello World!
          </p>
        </body>
      </html>
    `
  };

  const { width } = useWindowDimensions();
  return (
    <RenderHtml
      contentWidth={width}
      source={source}
    />
  );
}

Above is sample code but i change from inline css to style tag html but it's not work as well. So thanks in advanced for your reply.

this image is i used style tag html in head html image

And this image is i used inline css image

jsamr commented 2 years ago

The <style> tag is not yet supported. See also https://github.com/meliorence/react-native-render-html/issues/437#issuecomment-876426813 You are welcome to open a feature request in our canny. https://native-html.canny.io/features