Returns flags to make conditions based on the user-agent platform
npm install use-platform
yarn add use-platform
Make conditions based on the user-agent platform
const SignInScreen: React.FC = () => {
const { isMac, isIOS } = usePlatform();
const shouldShowSignInWithApple = isMac || isIOS;
return (
<div>
{
shouldShowSignInWithApple && (
<button type="button">
Sign in with Apple
</button>
)
}
</button>
)
}
Feel free to file a new issue with a respective title and description on the use-platform repository. If you already found a solution to your problem, I would love to review your pull request! Have a look at our contribution guidelines to find out about the coding standards.
Check out the contributing page to see the best places to file issues, start discussions and begin contributing.
Released in 2020 This package is under the MIT license.
Made with love by Laura Beatris 💜🚀