a-tokyo / react-apple-signin-auth

 Apple signin for React using the official Apple JS SDK
https://a-tokyo.github.io/react-apple-signin-auth
MIT License
104 stars 13 forks source link

Custom callback onClick #69

Closed DDexster closed 2 years ago

DDexster commented 2 years ago

It would be great to provide some callback when Apple button is clicked, in order to prevent app interaction when the popup is triggered.

a-tokyo commented 2 years ago

You can use the render prop to achieve that.

eg:

/** Apple Signin button */
const MyAppleSigninButton = () => (
  <AppleSignin
    // ... config
    /** render function - called with all props - can be used to fully customize the UI by rendering your own component  */
    render={(props) => <button {...props} onClick={() => {
       // do custom handling here
       props.onClick();
    }}>My Custom Button</button>}
  />
);