0

Hello guys im trying to find a react-native code which is equivalent to the html code below:

   <a href="#Ducks">Ducks Section</a>
    <br>
    <br>
    <br>
    <p name="Ducks">this is about ducks</p>
Gia Mae
  • 11
  • 2

1 Answers1

0

Consider wrapping a Text component in a TouchableOpacity.

class App extends Component {
  
  render() {
    return (
      <View>
        <TouchableOpacity>
          <Text style={{color: 'blue'}} onPress={() => {}}>
             Ducks Section
          </Text>
        </TouchableOpacity>
        
        <TouchableOpacity style={{marginTop:50}}> <!-- According to you requirement-->
          <Text style={{color: 'blue'}} onPress={() => {}}>
             this is about ducks
          </Text>
        </TouchableOpacity>
      
      <View>
    );
  }
}

You can use a react-native-hyperlink component for react-native-web that makes urls, fuzzy links, emails etc clickable. More discussion found here

Nooruddin Lakhani
  • 7,507
  • 2
  • 19
  • 39
  • i just want to scroll down to specific section when links clicked not to redirect to other web links – Gia Mae Nov 10 '20 at 02:10