native-apple-login
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

native-apple-login

installation

$ yarn add native-apple-login
$ cd ios
$ pod install

how to use

import AppleLogin from "native-apple-login";

const login = async () => {
    const result = await AppleLogin.login();
}

Apple Credential State Change Listener

import AppleLogin, {
  Events,
  EventNames,
  CredentialStateChangedResult,
} from 'native-apple-login';

export default function App() {
    const eventSubscription = React.useRef<EmitterSubscription | null>(null);

    React.useEffect(() => {
        eventSubscription.current = Events.addListener(
        EventNames.CredentialStateChanged,
            ({ state, error }: CredentialStateChangedResult) => {
                if (state === "revoked") {
                    logout();
                }
            }
        );
        return () => {
            if (eventSubscription && eventSubscription.current) {
                eventSubscription.current.remove();
            }
        };
    }, []);

    const fetchList = async () => {
        NaitveAppleLogin.getCredentialState(await AsyncStorage.getUserAppleId());
        await getList();
    }
}

Package Sidebar

Install

npm i native-apple-login

Weekly Downloads

1

Version

0.1.2

License

MIT

Unpacked Size

50.9 kB

Total Files

15

Last publish

Collaborators

  • killi8n