web icon indicating copy to clipboard operation
web copied to clipboard

Cannot style the Link component

Open barnesheaton opened this issue 7 years ago • 4 comments

Current Behavior

Adding a style prop to a Link does not change the style of the Link

import { Link } from '@react-navigation/web'

<Link routeName="Landing" style={{ textDecoration: 'none' }}>
        <PrimaryButton title={'◀︎ Back to Home'} style={styles.button} />
</Link>

Expected Behavior

The child components should not be underlined (or textDecorated)

How to reproduce

I believe the same issue is reproduced here? https://github.com/react-navigation/web-server-example/blob/master/src/AppView.js

Your Environment

software version
@react-navigation/web 1.0.0-alpha.7
react-native-web 0.5.4
node 9.11.2
yarn 1.7.0

barnesheaton avatar Dec 05 '18 16:12 barnesheaton

I'm also facing this issue when trying to style via the class prop of the Link component.

jeevcat avatar Dec 29 '18 17:12 jeevcat

Same here using:

"@react-navigation/core": "^3.0.2",
"@react-navigation/web": "^1.0.0-alpha.7",

Is there a solution?

npomfret avatar Jan 18 '19 12:01 npomfret

Facing the same issue, I created a PR (https://github.com/react-navigation/react-navigation-web/pull/12) that solves the problem passing all props to the anchor. Including style, className and every props you may set to the <Link />

clementmoine avatar Feb 08 '19 14:02 clementmoine

as a work around for now:

      <Link routeName="Home">
        <Text
          style={{
            color: 'white'
          }}
        >
          Home
        </Text>
      </Link>

djstein avatar Sep 03 '19 04:09 djstein