Skip to content

LeftButton was not rendered #1320

Closed
Closed
@anjar10

Description

@anjar10

Version

Tell us which versions you are using:

  • react-native-router-flux: 3.36.0,
  • react-native v0.34.1

Expected behaviour

Rendering priority:
-Left Button
-Back Button

Actual behaviour

Rendering priority:
-Back Button
-Left Button

Steps to reproduce

  1. Create scene1 and scene2
  2. From scene1 create a button to redirect to scene2 (stack = [scene1, scene2])

In scene2:

  1. Set hideBackImage = true, renderBackButton = null
  2. Set leftButtonImage = an image, onLeft = a function

In scene2, leftButton was not rendered. Maybe it was caused by:
-renderBackButton in scene2 always return not null component (because scene2 is child of scene1)
renderBackButton return null if and only if the scene is a root
if (state.index === 0 && (!state.parentIndex || state.parentIndex === 0)) { return null; }

-rendering priority
Here is source code to render NavBar
<View> {renderTitle ? renderTitle(navProps) : state.children.map(this.renderTitle, this)} {renderBackButton(navProps) || renderLeftButton(navProps)} {renderRightButton(navProps)} </View>
renderLeftButton in scene2 was never rendered, because, it's priority is lower than renderBackButton

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions