0

Problem

I get some html from an api endpoint. This html contains internal links like this: <a href="#my-item" /> which should scroll to <a id="my-item" href="#">My Item</a> when clicked.

My problem is that the default behavior for rendered links in react-native-render-html is this:

By default, pressing an anchor will open the link in the system browser. This is done with React Native ​Linking API.

That is not the desired behavior, I want it it auto-scroll to the correct tag.

Code

How can I accomplish this? I have specified a custom onPress function for <a/> tags, but how can program the default browser behavior?

  const renderersProps = {
    a: { onPress: handleLink },
  };
Gh05d
  • 7,923
  • 7
  • 33
  • 64

0 Answers0