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
[native] Add 'component' prop to DOM 'Link' #4625
Comments
Can you not use react-router-native's Link on react-native-web? |
You still need a DOM-based router. We'd use this on mobile.twitter.com too |
We get this request often but I'm not sure anything will ever convince me to support it. On the web an If we supported
The point of Now ... that said, your use-case is the first one where I'm like "oh, that's interesting." Any ideas on how to support your goals w/o giving people a footgun? |
oh hey ... check this out: componentDidMount() {
warning(findDOMNode(this).tagName !== 'A', 'YOU BLEW IT!')
} s/YOU BLEW IT!/[some actual message about needing to render an anchor]/ |
I'm not familiar with React Native so I'm curious if this is different -- on web if you want your <Link to="kittens.com">
<img ... />
</Link> or: <Link to="/about">
<FancyFlexLayoutMenuItemWithDancingIcons>About</...>
</Link> I've never run into a situation where my ability to style or use a Link depended on bypassing the |
I figured there would be less interest in creating a router-agnostic It's certainly a set of complicated trade offs. Warning if the base tag is not an anchor sounds like a reasonable approach. I can get back to you with some specific examples of what we do or want to do |
@ryanflorence +1 for warning about using something other than a @necolas I'd be grateful if you could take a look at our native |
@mjackson you have refs and you have findDOMNode. I don't know how to use refs to get to the dom node when the component passed in can be several levels of components before getting to the On another note, we don't even know if our props (
How do we:
|
It's not the native Link he wants changed. The native Link already supports the What he's asking for is for the dom Can't this be solved in react-native-web? |
@ryanflorence When @necolas said:
I thought he was critiquing our current native |
Oh, sorry, I was reading to hastily :( Yeah, we need major help on the |
To clarify: I meant React Native for Web. If you want to run your RN components (that use RR) on the web, you can't because the I'll take a look at what an implementation of Link might look like if it's built with the RNW API. |
I found this issue while searching for a solution to another valid use case. We use
to get a styled component that will still render I understand the push for verifying that what gets rendered is in fact an anchor tag, but it would be great to allow some type of customization here. |
@lamflam You can do that with glamorous's composition: const Anchor = glamorous(Link)({ /* ...styles */ }) |
Closing due to inactivity. I still think the Link component API could be more platform-independent. But you can make your own Link and use that instead of what is in RR |
@timdorr Can't believe I missed that, but thank you for pointing it out, works great! |
The native router's
Link
component has a different props interface to the DOM packageLink
. It would be good to align them a little closer, for example, supporting thecomponent
prop for the DOM variant. This would a allow people to more easily use the router with something likereact-native-web
The text was updated successfully, but these errors were encountered: