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

[NavigatorIOS] Add ability to set custom component as title

Open Alexxzz opened this issue 11 years ago • 26 comments

UIKit's UINavigationItem has a UIView property 'titleView' which allows to set custom view as a navigation bar title. Would be nice to have that in react-native. Two ways as I see it:

  1. Child component of the NavigatorIOS:
<NavigatorIOS
  itemWrapperStyle={styles.nav}
  initialRoute={{
    component: NewsView
  }}>
{someFancyCustomTitleComponent}
</NavigatorIOS>
  1. Parameter of the NavigatorIOS:
<NavigatorIOS
  itemWrapperStyle={styles.nav}
  initialRoute={{
    component: NewsView
  }}
  titleComponent={someFancyCustomTitleComponent}
/>

So probably child component or parameter(or other way of ding it?) should be set to the instance of RCTNavItem and then RCTWrapperViewController should set it to corresponding UINavigationItem's titleView, but I don't have any idea how to convert react component to UIView.

Alexxzz avatar Mar 30 '15 22:03 Alexxzz

Sorry for leaving this so long - I've ended up using https://github.com/wix/react-native-navigation and https://github.com/wix/react-native-controllers.

I'm sure this is heavily debated elsewhere but for me the idea of React Native was to use native components (as per above)...not a non-native feeling replacement (Navigator Experimental)

lprhodes avatar Aug 19 '16 23:08 lprhodes

@facebook-github-bot label Icebox

charpeni avatar Nov 14 '16 01:11 charpeni

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/navigatorios-add-ability-to-set-custom-component-as-title

ProductPains helps the community prioritize the most important issues thanks to its voting feature. It is easy to use - just login with GitHub.

Also, if this issue is a bug, please consider sending a PR with a fix. We're a small team and rely on the community for bug fixes of issues that don't affect fb apps.

charpeni avatar Nov 14 '16 01:11 charpeni

@facebook-github-bot close

charpeni avatar Nov 14 '16 01:11 charpeni

@charpeni tells me to close this issue. If you think it should still be opened let us know why.

facebook-github-bot avatar Nov 14 '16 01:11 facebook-github-bot

Easily achievable with https://reactnavigation.org now.

Alexxzz avatar Apr 14 '17 16:04 Alexxzz