Simple mobile application to save words in dictionaries, built withreact-nativeandreact-native-firebase.
Click on the picture to watch a brief video ↑
I made this application for personal usage and is not intended to be on Apple / Google stores, you will have to create your own Firebase project.
- Create aFirebase project.
- Enable
Email/Password
sign-in provider from theFirebase console(Authenticationsection). - Create aFirestoredatabase from theDatabasesection, when you have to choose the database rules, select locked mode, you will adjust the rules in the next step.
- Update the database rules from
Database
->Rules
and copy paste the following snippet:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth.uid!= null;
}
}
}
This rule allows only authenticated user to read / write into the database.
- Install
react-native
on your computer. The project is not using Expo, as a result you have to follow the instructions from theReact Native CLI Quickstart
section of theofficial documentation. Make sure you are able to launch an Hello Worldreact-native
application before continuing! git clone https://github.com/akiver/wordsreminder.git
(or download the project archive).cp.env.example.env
yarn
(never tested withnpm
)
Follow the instructions below for your target platform.
Follow common steps from thesetup sectionbefore continuing!
sudo gem install cocoapods
(if you doesn't haveCocoaPodsinstalled on your MAC).- Generate your ownGoogleService-Info.plist(When asking for aiOS bundle ID,use someting like
com.myusername.wordsreminder
). - Copy your
GoogleService-Info.plist
intoios/WordsReminder/GoogleService-Info.plist
yarn pod
yarn ios
(will run the app in simulator)
Follow common steps from thesetup sectionbefore continuing!
- Download your
google-services.json
from the project settings of thefirebase console. - Edit this file and rename the field
package_name
tocom.wordsreminder
. - Move the file into
android/app/google-services.json
. yarn android
(will run in simulator).
Follow iOS steps from thesetup sectionbefore continuing!
- Setup a code signin team account(You don't need to be part of Apple Developer Program to install the app on your own device).
yarn global add ios-deploy
(Required to install the application wihtout xCode)yarn ios:release --device= "Device name"
You can find your device's name fromSettings
->General
->About
.
Follow Android steps from thesetup sectionbefore continuing!
- Generate a signin key with theofficial doc.
yarn android:release --deviceId= "Device ID"
You can find your device ID withadb devices
.
End-to-end tests are made withDetoxand it uses a real Firestore database.
When building the application for E2E tests, the Firestore collections names differ from those used in the "real" application.
Default names should be fine but you can change it from the.env
file.
All variables withE2E_
prefix are related to E2E tests.
Each test suites must be able to run independently.
You can run 1 specific test suites withyarn e2e:test:ios e2e/tests/sign-in.test.ts
for example.
Before runningyarn e2e:build:ios
oryarn e2e:build:android
,make sure to kill any Metro processes, otherwise it may use the wrong collections names if Metro was started byyarn ios
oryarn android
!
- Generate a service account key (it's a
json
file) from the Firebase consolehttps://console.firebase.google.com/project/PROJECT-ID/settings/serviceaccounts/adminsdk(replace PROJECT-ID by your Firebase project ID in the URL). - Copy paste the json file into the
e2e
folder and rename it togoogle-services.json
. - (optional) You can change the
E2E_xxx
variables from the.env
if needed.
- Make sure to meet the Detoxrequirementsand installapplesimutils.
yarn e2e:build:ios
yarn e2e:test:ios
When running tests from the simulator, make sure the keyboard is visible, otherwise tests will fail because typing will not work! (it's configurable from Hardware => Keyboard => Toggle software keyboard)
If you want to run E2E tests with the release build, useyarn e2e:build:ios:release
thenyarn e2e:test:ios:release
.
yarn e2e:start
yarn e2e:build:android
yarn e2e:test:android
If you want to run E2E tests with the release build, useyarn e2e:build:android:release
thenyarn e2e:test:android:release
.
Migrations allow to change database scheme, data...
All migrations must be inside themigrations
folder and export arun
function.
- Replace
PROJECT_ID
by your project ID in the.env
file, your project ID is available from theFirebase console. - Create a service account key (it's a json file) from theGoogle console.
- Rename the
.json
file toserviceAccountKey.json
and paste it into themigrations
folder. yarn migrate
To generate a svg into a React component:
npx @svgr/cli --icon --native file.svg