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

bug: IonBackButton on React behaves wildly #19731

Closed
marcoromag opened this issue Oct 23, 2019 · 1 comment
Closed

bug: IonBackButton on React behaves wildly #19731

marcoromag opened this issue Oct 23, 2019 · 1 comment
Labels
package: react @ionic/react package

Comments

@marcoromag
Copy link

marcoromag commented Oct 23, 2019

Hi,

The IonBackButton behaves in very strange manners. In the snipped below. I have created three pages:

Page A routes to Page B
Page B routes to Page C
Page C routes to Page A

Test 1: run app. Page A is displayed
Expected behaviour: The IonBackButton is not shown
Current behaviour: The IonBackButton is present!

Test 2: run app. Click on button 'Go to Page B'. Click on button 'Go to Page C'. Click Back
Expected behaviour: Page C goes back to page B, and the back button is still present because the app can go back to Page A
Current behaviour: the IonBackButton does not show on Page B

const createPage = (title: string, next: string) : React.FC => () => (
  <IonPage>
    <IonHeader>
      <IonToolbar>
          <IonButtons slot="start">
             <IonBackButton/>
          </IonButtons>
          {title}
      </IonToolbar>
    </IonHeader>
    <IonContent>
      <IonButton routerLink={`/${next}`}>Go to page {next}</IonButton>
    </IonContent>
  </IonPage>
)

const App: React.FC = () => (
  <IonApp>
    <IonReactRouter>
        <IonRouterOutlet>
          <Route exact path="/A" component={createPage('Page A','B')}/>
          <Route exact path="/B" component={createPage('Page B','C')}/>
          <Route exact path="/C" component={createPage('Page C','A')}/>
          <Route exact path="/" render={() => <Redirect to="/A" />} />
        </IonRouterOutlet>
    </IonReactRouter>
  </IonApp>
);
@ionitron-bot
Copy link

ionitron-bot bot commented Nov 22, 2019

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: react @ionic/react package
Projects
None yet
Development

No branches or pull requests

3 participants