Sign-in button
The package ships no UI. The example app has an AppleSignInButton built from NitroUI views on top of AppleSignIn.signIn, styled to Apple's Human Interface Guidelines. Copy these two files into your app:
Preview
buttonStyle
text
disabled
A web rendering of the same colors, labels and metrics as AppleSignInButton.tsx: 44 pt high, 16 pt horizontal padding, a 17 pt logo and 17 pt semibold label 6 pt apart, and 0.38 opacity while disabled or busy.
Usage
{
AppleSignIn.isSupported() && (
<AppleSignInButton
buttonStyle="black" // black, white or whiteOutline
text="continue" // signIn, signUp or continue
options={{ scopes: ['fullName', 'email'] }}
onSignIn={(credential) => sendToBackend(credential.identityToken)}
onCancel={() => {}}
onError={(error) => showError(getAppleSignInErrorCode(error))}
/>
)
}
The button ignores taps while sign-in runs, so a double tap never rejects with IN_PROGRESS. Render it only when AppleSignIn.isSupported() returns true.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
onSignIn | (credential: AppleCredential) => void | required | Receives the credential after a successful sign-in. |
onCancel | () => void | Called when the user closes Apple's sheet. | |
onError | (error: unknown) => void | Receives failures. Left out, failures reject unhandled. | |
options | AppleSignInOptions | Passed to AppleSignIn.signIn on every tap. | |
text | 'signIn' | 'signUp' | 'continue' | 'signIn' | The label. |
buttonStyle | 'black' | 'white' | 'whiteOutline' | 'black' | Use white or whiteOutline on dark backgrounds. |
cornerRadius | number | 6 | Corner radius in points. |
disabled | boolean | false | Dims the button and ignores taps. |
layout | ViewProps['layout'] | Outer layout such as margins or width; the button keeps its height and padding. |
Styles and labels
buttonStyle | Background | Border | Content |
|---|---|---|---|
black | #000000 | none | #FFFFFF |
white | #FFFFFF | none | #000000 |
whiteOutline | #FFFFFF | 1 pt #000000 | #000000 |
text | Label |
|---|---|
signIn | Sign in with Apple |
signUp | Sign up with Apple |
continue | Continue with Apple |