1

I want to display a link button instead of button on my react native page. Right now I have the below code:

<Button onPress={this.handleGetDirections} title="Get Directions" />

I want to show the above button as a link. How can I achieve this in React Native.

Thank You.

Anjali
  • 2,540
  • 7
  • 37
  • 77

2 Answers2

1

If it is about the styling of a link within the browser. That's done by the default browser vendor styles. You won't have that happen in react-native.

You can have a simple Text element that is styled to look like a link (ie: blue) and have a onPress handler for that.

Just follow Pritish Vaidyas... link :)

Hope this helps

flaky
  • 6,816
  • 4
  • 29
  • 46
1

Use textDecorationLine.

E.g :

 <TouchableOpacity>
        <Text style={styles.underLineText}>Your underline Text</Text>
      </TouchableOpacity>

underLineText: {
    fontSize: 12,
    textDecorationLine: 'underline',
    color: 'white',
    fontWeight: 'bold',
    textAlign: 'center',
  }
Vivek_Neel
  • 1,343
  • 1
  • 14
  • 25