Skip to content
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

activeClassName not working #471

Closed
mxaly opened this issue Nov 14, 2014 · 14 comments
Closed

activeClassName not working #471

mxaly opened this issue Nov 14, 2014 · 14 comments

Comments

@mxaly
Copy link

mxaly commented Nov 14, 2014

using React 0.12.0 when navigating, class to selected link is not added.

@ryanflorence
Copy link
Member

can you provide a test case somewhere? it works in the examples in this repo.

@mxaly
Copy link
Author

mxaly commented Nov 15, 2014

Weird... Looks like it's not working only in one case. I don't have separated example but since it's in public project, you can take a look:

router
tags
tag_nav - here it's not working
link - here it's working

I will investigate it later. Maybe it's just a bug in my app.

@gaearon
Copy link
Contributor

gaearon commented Nov 17, 2014

@mxaly

Perhaps params={@props.tag} ought to be params={name: @props.tag}?

@mxaly
Copy link
Author

mxaly commented Nov 17, 2014

tag is an object with name field inside so it should work that way or params={name: @props.tag.name}

@gaearon
Copy link
Contributor

gaearon commented Nov 17, 2014

I was confused by apparently different usage in link.cjsx and tag_nav.cjsx (here presumably tag is a string?)

@mxaly
Copy link
Author

mxaly commented Nov 17, 2014

yep, link have tags array(strings). tag_nav and related tag components use TagsStore where tags are objects. It could be confizing. Anyway i still can't get solution for that.

@gaearon
Copy link
Contributor

gaearon commented Nov 17, 2014

Are you using react-bootstrap? This could be one of the problems with router depending on slightly broken feature (context) in React: #400 #470

@mxaly
Copy link
Author

mxaly commented Nov 18, 2014

it's in package but i'm not using it (waiting for 0.12.0 compatibility). Pure bootstrap there css there for now

@gaearon
Copy link
Contributor

gaearon commented Nov 18, 2014

Could you by any chance have several copies of React loaded? This often leads to obscure bugs, although I'm not at all sure about this one.

@mxaly
Copy link
Author

mxaly commented Nov 18, 2014

what do you mean? I'm requiring react when it's needed. Could it be problem?

@gaearon
Copy link
Contributor

gaearon commented Nov 18, 2014

@mxaly Basically you need to check if there's no react-router/node_modules/react (or react-bootstrap/node_modules/react, etc, you get the idea) because this would cause obscure bugs.

@mxaly
Copy link
Author

mxaly commented Nov 18, 2014

oh, will do, thanks!

@ryanflorence
Copy link
Member

I'm pretty confident this is working as designed, let use know if you discover anything that you think we need to fix.

@areim3r
Copy link

areim3r commented Dec 21, 2015

@ryanflorence is there a way to set the activeClassName for the containing li ? its working fine so I didn't feel it was worth opening a new issue but say for bootstrap pills navigation, you set the active class on the li not the a, which means that by default the bootstrap active class won't work. there is this component which is supposed to do that but it seems it doesn't work as of react-router v1.0

@lock lock bot locked as resolved and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants