Nhost React Native Template
This template bootstrapped using react-native-community/cli showcases how to properly use Nhost SDK within your React Native project.
For a more comprehensive guide on how to build on top of this template you can follow the quickstart guide.
Features
- Email/Password Authentication
- Sign-in with Apple and Google
- File upload
Usage
Ensure that your environment is set up to work with React Native. Follow the setup guide available on the official React Native website.
-
Initialize your project with this template
npx react-native init myapp --template @nhost/react-native-template
-
Replace the subdomain and region placeholders in the root.tsx with your Nhost project values from the overview page.
How to enable Sign in with Apple and/or Google
Navigate to your nhost project Sign-In Methods settings and enable Google and/or Apple.
Configure Permissions for uploading files
-
Edit the files table permissions
- Navigate to the files table within the Database tab
- Click on the three dots (...) next to the files table
- Click on Edit Permissions
-
Modify the Insert permission for the user role:
- Set
Row insert permissions to Without any checks
- Select all columns on
Column insert permissions
- Save
-
Select
- Set Row select permissions to With custom check and fill in the following rule:
- Set Where to files.uploaded_by_user_id
- Set the operator to _eq
- Set the value to X-Hasura-User-Id
- Select all columns on Column select permissions
- Save