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

how to add additional rule inside alterNode function? #3

Closed
azuddin opened this issue Jun 29, 2019 · 1 comment
Closed

how to add additional rule inside alterNode function? #3

azuddin opened this issue Jun 29, 2019 · 1 comment

Comments

@azuddin
Copy link

azuddin commented Jun 29, 2019

having difficulties on how to add additional condition to alterNode function without overriding it.
other than manually updating the package, is there any way to do it?
i wanted to add these to alterNode function

if (node.name === "img") {
node.attribs = {
...(node.attribs || {}),
style: height:"auto";
};
}

@azuddin
Copy link
Author

azuddin commented Jun 29, 2019

Nvm, just found the solutions.

import { alterNode as alterNodeTable } from "react-native-render-html-table-bridge";

<HTML alterNode={node => {
   const { name, parent } = node;
   alterNodeTable(node);
   if (name === "img") {
         node.attribs = {
             ...(node.attribs || {}),
             style: `height:"auto";`
        };
        return node;
   }
}}/>

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

No branches or pull requests

1 participant