react-native icon indicating copy to clipboard operation
react-native copied to clipboard

NavigationBar RightButton runtime render

Open jaygarcia opened this issue 11 years ago • 4 comments

Any thoughts on if you guys are planning on adding the capability to inject/render RightButton programmatically?

I'm thinking of the iOS music player "now playing button" (yeah, the bottom image is from android). It only appears when you've actually started playing music and go back to browsing.

I'd like to inject that type of feature into this Mod Player demo app that i've been working on.

Thanks =)

jaygarcia avatar Apr 24 '15 14:04 jaygarcia

And Oh snap. This is issue number 1000!

jaygarcia avatar Apr 24 '15 14:04 jaygarcia

Are you referring to this text in the NavigatorIOSExample?

            this.props.navigator.replace({
              title: 'New Navigation',
              component: EmptyPage,
              rightButtonTitle: 'Undo',
              onRightButtonPress: () => this.props.navigator.replace(prevRoute),
              passProps: {
                text: 'The component is replaced, but there is currently no ' +
                  'way to change the right button or title of the current route',
              }
            });

NavigatorIOS isn't really maintained by FB - maybe @eduardinni or @ide could help out?

sahrens avatar Apr 24 '15 22:04 sahrens

I think you can achieve this behavior using a state var on the main route, and then play with rightButtonTitle and onRightButtonPress through props when push/replace new routes.

If you pass null to rightButtonTitle the button will not render.

eduardinni avatar Apr 24 '15 23:04 eduardinni

@jaygarcia Did you get this resolved?

christopherdro avatar May 29 '15 18:05 christopherdro