Open drfarch opened 4 years ago
I just went through the same thing. Just replace onPress
with action
and it should work!
Example:
<AwesomeButton
type="primary"
role="button"
action={() => {
alert('button pressed');
}}
>
Portfolio
</AwesomeButton>
next
is the second parameter !The problem is that the first argument of the onPress
's callback function is not the next
function but the ref
of the <Button/>
(so it returns us a <span/>
). The next
function is actually the second parameter of the callback function.
<AwesomeButton
type="primary"
role="button"
onPress={(ref, next) => {
// next is the second parameter !
next();
}}
>
Portfolio
</AwesomeButton>
Either the documentation is incomplete, either it's a bug that needs to be fixed. I'll make a PR proposing an update to the current documentation.
import { AwesomeButtonProgress } from 'react-awesome-button'; import AwesomeButtonStyles from 'react-awesome-button/src/styles/styles.scss'
function Button() { return ( <AwesomeButtonProgress cssModule={AwesomeButtonStyles} type="primary" onPress={next => { // do a sync/async task then call
next()
console.log("test"); next() }}i tried this code that i get from 'AwesomeButtonProgress basic example' docs