larsvinter / react-native-awesome-button

A button React Native component supporting showing different states with animations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

onState function

pvinis opened this issue · comments

how would i add an onState function? for example, in the advanced example, i would like to have an onSuccess={() => console.log('done') or onState={(state) => {if (state === 'success') { console.log('done')}} so something happens when a state is reached. how can i do that?

Hi. The AwesomeButton component simply renders the view as a function of the state you pass into it (i.e. the buttonstate). It transitions between states using animations. There is no callback from this component as there is no "activity" happening. The only callback that exists is when the user presses the button. This you register using the onPress prop.