- UI KIT : native-base
- Backend: Firebase via react-native-firebase
- Navigation : react-navigation
- State management : react-redux
- Store persistence : redux-persist
- Forms : formik
If you received the DEVELOPER_ERROR message when signing in, then you will need to add your SHA-1 fingerprint to the Firebase app.
- Retrieve your SHA-1 fingerprint by following one of the answers here depending on your OS
- On your firebase askme app console, navigate to Project Settings > General. Scroll all the way down, you should see "Your Apps"
- On "Askme Android (com.askme)", click "Add fingerprint"; and add your fingerprint you retrieved earlier
- /api/
- /paths/
- put your API functions here, preferably in identifiable files
- index.js
- bootstraps all your API functions from /paths into a single callable
api(path/fn)
function.
- bootstraps all your API functions from /paths into a single callable
- /paths/
- /components
- Keep your general components here
- /screens
- /auth/
- contains screens required in authentication; when the user is not logged in
- /user
- contains screens to display to the logged-in user
- index.js
- specifies "routing" to the screens in /auth and /user.
- /auth/
- /store
- /actions
- contains redux actions
- /reducers
- contains reducers
- index.js
- exports redux store
- /actions
- /utils
- contains helper functions
- Since y'all will be adding screens related to when an user is authenticated, add your screens to screens/user/pages (try to create folders to avoid clutter, eg: Keep your Quiz related screens in screens/user/pages/Quiz).
- Then add a route at the
default
export in screens/user/routes.js, like so:
Dashboard: { screen: require("./pages/Quiz").default, },
- When you need to route to another screen, you can do so by calling the "key" of which your registered your screen to. Take the above example which I registered my Dashboard screen at the
Dashboard
key. So when you need to navigate to this screen from elsewhere, you can dothis.props.navigation.navigate('Dashboard')
- You should add API functions into the /src/api/routes folder. Look at the existing files in that folder for reference. If you want to create another file in the routes folder, then make sure to link that file in the
paths
object at /src/api/index.js like so:
const paths = {
notifications: require("./routes/notifications").default,
users: require("./routes/users").default
}
- In order to use the API in your component, you will need to call the
api(file/method)
wheremethod
is the name of the API function andfile
is name of the file in src/api/routes where the method is located. So for example I added a new API function calledgetUsers
in src/api/routes/users, then I will callapi(user/getUsers)
import api from "api"
class Example extends Component {
myMethod(){
api("file/method", {params}).then(res => {
}).catch(err => {
})
}
...
}