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

[NavigatorIOS] resetTo will not change the title or rightButton #476

Closed
lazywei opened this issue Mar 30, 2015 · 21 comments
Closed

[NavigatorIOS] resetTo will not change the title or rightButton #476

lazywei opened this issue Mar 30, 2015 · 21 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@lazywei
Copy link

lazywei commented Mar 30, 2015

I'm not sure if this is a feature or a bug.

My initial route:

return <NavigatorIOS
       style={{flex: 1}}
       initialRoute={{
               component: Login,
               title: 'Login',
       }} />;

in Login, I have such function to handle reseting route:

_handleLogin() {
     this.props.navigator.resetTo({
       component: ChatList,
       title: 'Chat List',
     });
},

However, the title seems not change even the ChatList is rendered correctly.

@a-warner
Copy link

This is happening to me as well, pretty sure it's a bug, since pushing another route afterwards and then popping does change the title correctly to the title specified in resetTo

@pwmckenna
Copy link
Contributor

This seems to be a bug with any navigation that defers to replaceAtIndex, which doesn't do the locking that push/pop/etc do.

This might also have to do with the fact that the navigation containers are keyed by index, rather than some combination of the route+index. I haven't been able to change that key to something more unique without running into the locking issue mentioned above, but if the key has not changed, I wouldn't expect React to re-render the nav bar title. This also would explain why push/pop changes the title, because the container is briefly unmounted, so even though the key is reused, it must be mounted again causing a render.

@pwmckenna
Copy link
Contributor

@ericvicenti thoughts? If I was on the right path I could try put a pull request together. Don't really have a sense of the scale of the issue though.

@ericvicenti ericvicenti removed their assignment May 6, 2015
@ericvicenti
Copy link
Contributor

Yeah, it sounds like you are on the right track. If this is affecting you then I would see what you can do to fix it or work around it. We don't use NavigatorIOS internally, so we can't spend much time fixing things, but we are happy to accept any fixes that people contribute.

@AdamBrodzinski
Copy link

+1 I'm having to same issue too.

@pwmckenna
Copy link
Contributor

@ericvicenti do you guys just use navigator internally?

@ericvicenti
Copy link
Contributor

Yep, we only use the Navigator in our apps right now. It gives us a bit more flexibility over gestures and animations, and we're using it on Android as well, which helps us share code.

We don't have the bandwidth to support components which aren't used by our internal clients, so it is up to the community to maintain NavigatorIOS. We are happy to accept your PRs!

@jaredly
Copy link
Contributor

jaredly commented May 20, 2015

@pwmckenna the base issue is that NavigatorIOS doesn't have the logic for updating nav items in-place see source

@brentvatne
Copy link
Collaborator

@jaredly - seems like this is worth adding support for - I had an initial shot at this here, we could use the same strategy for other props

@brentvatne brentvatne changed the title NavigatorIOS resetTo will not change the title NavigatorIOS resetTo will not change the title or rightButton May 31, 2015
@brentvatne brentvatne changed the title NavigatorIOS resetTo will not change the title or rightButton [NavigatorIOS] resetTo will not change the title or rightButton May 31, 2015
@mccambridge
Copy link
Contributor

I seems as if replace suffers from the same issue.

@Iragne
Copy link
Contributor

Iragne commented Jul 8, 2015

well i create this PR for that #1733

@AdamBrodzinski
Copy link

I've found a work around to use resetTo that resets the title. When you want to use resetTo, save a reference to the route and use replace instead.

 nextPage() {
    global.__feedRoute = {
      title: 'Feed',
      component: require('../FeedContainer')
    };
    this.props.navigator.replace(__feedRoute);
  }       

Then in the next component (Feed in this example), call resetTo which removes the back button and animates in.

  // Feed.js
  componentWillMount() {
    this.props.navigator.resetTo(__feedRoute);
  },          

The first call to replace will change the title and hopefully the right button, this also does not animate it. The next call to replaceTo will reset the stack and you should be good to go.

@hanai
Copy link

hanai commented Sep 7, 2015

same problem with replace

@Iragne
Copy link
Contributor

Iragne commented Sep 7, 2015

may be this PR can help
#2526

@matejkramny
Copy link

replace has the same issue.

What needs to happen to fix this? Any way i can help?

@cancan101
Copy link
Contributor

There is this: #3516

@kevinsqi
Copy link

#3516 was replaced by #3809. Seems like @rocman has a potential fix, but is dealing with a failing CI build.

@Iragne
Copy link
Contributor

Iragne commented Nov 21, 2015

I check both implementation in objective c. i think the delegate link in this pr #2526 is more code compliant.

@longsangstan
Copy link

I use <Navigator> and have similar issue.
The old rightButton still clickable (although hidden) after pushing to the new route.

@DenisIzmaylov
Copy link

Up!

@lacker
Copy link
Contributor

lacker commented Oct 21, 2016

AFAICT this issue now covers a number of different problems, of which #3809 and #2526 fixed two of them. I am going to close this issue but if there is still a problem then I encourage folks to open a new issue with a repro of the specific bug in a rnplay.org link.

@lacker lacker closed this as completed Oct 21, 2016
facebook-github-bot pushed a commit that referenced this issue Mar 15, 2017
Summary:
This fixes ```align-content: center``` and ```align-content: flex-end``` when the child exceeds the parents size. See #476. It also fixes those layouts if the child has ```margin: auto``` set.
Closes facebook/yoga#477

Differential Revision: D4697833

Pulled By: emilsjolander

fbshipit-source-id: d081ec7ea559a5f2bd3271c3a4dc272960beddfa
@facebook facebook locked as resolved and limited conversation to collaborators Jul 23, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests