Bernardo Prior
Bernardo Prior

Reputation: 21

Why aren't my events on Ionic-React working?

Right now, I'm developing my first app using Ionic with React and I'm having some problems dealing with events with Ionic Components.

I'm trying to run a fucntion only when a Slide changes on a Component. Have been reading all the documentation about it but nothing worked, so probably I'm doing something wrong.

This is my code right now:

<IonSlides
        ionSlideDidChange={() => console.log("a")}
        pager={false}
        class="full-width"
      >
        <IonSlide class="full-width">
          {!loadingAchiv && (
            <Achievements achievementsList={this.state.achievementsList} />
          )}
        </IonSlide>
        <IonSlide class="full-width">
          {!loadingUsers && <Leaderboard users={this.state.userList} />}
        </IonSlide>

My guess was to try ionSlideDidChange just like an OnClick event but it's not working at all. Probably I'm using ionic events in the wrong away. Could anyone explain me how to use this in a proper way?

Thanks!

Upvotes: 0

Views: 460

Answers (1)

Bernardo Prior
Bernardo Prior

Reputation: 21

Ops, solved:

<IonSlides
        onIonSlideDidChange={() => console.log("a")}
        pager={false}
        class="full-width"
      >

Docs were confusing, you have always to change the event to: "onIon..."

Thank you everyone

Upvotes: 2

Related Questions