The following tree shows the structure of the components in the whole app.
- App
- Drawer
- Home
- AuthScreen
- Movies
- MainMoviesContainer
- DetailedMovieModal
- AddToFavorite
- DetailedMovieModal
- MainMoviesContainer
- Favorites
- MainFavoritesContainer
- DetailedMovieModal
- RemoveFromFavorite
- DetailedMovieModal
- MainFavoritesContainer
- LogOut
- Home
- Drawer
- React-Native
- react-navigation
- reduxjs/toolkit
- Redux (react-redux)
- Redux-presist
- expo-google-app-auth
- styled-components
- react-native-community/async-storage (used to manage favorites)
The state manager has been used for managing globaly the whole state of the app. The state contains:
- Movies Array containing all of the relevant information about the movies currently displaying on the main app.
- favorites array containing all the favorites Movies added by the users. Each item is a Movie object with all the relevant information to displayed it on the favorites page.
- fetchApiState is going to show the state of the fetch calls to the Movies API. Posible values are: LOADING | SUCCESS | FAILED.
- fetchMovies: This action will fetch all the movies from TMDB API.
- addToFavorites.js: This action will send a movie object given as parameter.
- removeFromFavorites.js: This action will remove a favorite movie which equals the movie id passed as parameter.
- movies: This reducer will handle the fetch movies actions.
- favorites: This reducer will handle the add to favorite and remove from favorite actions.
- TMDB API
- react-redux
- redux
- redux-persist
The project has tooked me 2 days. I started with all the fetching and rendering data part for the first 6 hours. The other time I have, I used for the app design and making it responsive.
- Adding global styles to the project, so I could reuse it and make the code more readable instead of writing fixed numbers.(e.g. background: ${({theme})=>theme.lightBlue})
- Making it works well with IOS users.
In order to start the project: - Open terminal . - Type: yarn -> yarn start . - Scan the QR code that given with your mobile device . - or open emulator and press 'a' on terminal to set it on emulator .