React-native-router-flux: renderRightButton displays button on left side of NavBar

Created on 31 Jul 2016  路  5Comments  路  Source: aksonov/react-native-router-flux

Version

Tell us which versions you are using:

  • react-native-router-flux v3.32.0
  • react-native v0.30.0

Expected behaviour

I would to render a custom icon for the right button with renderRightButton method. I'm using react-native-vector-icons. The button appears on left. The button works, but it is of the wrong side of the NavBar.

Actual behaviour

screenshot_20160731-164100

Steps to reproduce

const MenuIcon = <TouchableHighlight onPress={()=>Actions.menu()} style={{ backgroundColor: 'red', width: 30, height: 30}}> <Icon name="menu" size={30} /> </TouchableHighlight>;

<Scene key="home" component={HomePage} title="Home" onRight={()=>Actions.menu()} rightTitle="Menu" initial={true} renderRightButton={() => MenuIcon}/>

Most helpful comment

I sent Pull request (https://github.com/aksonov/react-native-router-flux/pull/1054) for solve this problem, and It was merged. Please check this function when next version bumped :smile_cat:

All 5 comments

I have the same issue :)

Can you try to fix it with style props?

@sarovin
yes, if I add "position: absolute" and "right: 0" or another number, the button is in the correct position, but I think than the right button should be on the right side by default and the style props should serve for micro adjustments :)

<TouchableHighlight onPress={()=>Actions.menu()} style={{ backgroundColor: 'red', width: 40, height: 40, right: 5, top: 5, position: 'absolute'}}>
        <Icon name="menu" size={40} />
    </TouchableHighlight>;

screenshot_20160804-220954

I sent Pull request (https://github.com/aksonov/react-native-router-flux/pull/1054) for solve this problem, and It was merged. Please check this function when next version bumped :smile_cat:

My navigationBarStyle is
{ flex: 1, flexDirection: 'row', justifyContent: 'center', alignItems: 'center', backgroundColor: 'transparent', borderBottomWidth: 0, }

I also have custom styles for renderTitle (using flex) and renderRightButton (using absolute) and it is broken with 3.36, although it works fine with 3.35. Probably because of this PR...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rafaelcorreiapoli picture rafaelcorreiapoli  路  3Comments

fgrs picture fgrs  路  3Comments

xnog picture xnog  路  3Comments

VictorK1902 picture VictorK1902  路  3Comments

YouYII picture YouYII  路  3Comments