This project follows the MVVM (Model-View-ViewModel) architectural pattern to a certain extent:
- Data is fetched from an external API.
- Data is rendered within the app.
- After rendering the data, it is used to check if the user already like the article and the data are transferred to a different screen.
- Redux is utilized to store user data across different screens.
/nytimes
|-- /src
| |-- /assets
| | |-- /icons
| |
| |-- /components
| |
| |-- /library
| | |-- assets.js
| |
| |-- /views
| |
| |-- /navigation
| | |-- DrawerNavigator.js
| | |-- StackNavigator.js
| |
| |-- /screens
| |
| |-- /store
| | |-- / actions
| | |-- / reducers
| | |-- Store.js
| |
| |-- App.js
|
|-- /android
|-- /ios
|-- .env
|-- package.json
|-- README.md
.env File Configuration:
Create a .env
file in the root directory with:
BASE_URL=https://api.nytimes.com
PUBLIC_KEY=<YOUR_NYTIMES_PUBLIC_KEY>
Replace <YOUR_NYTIMES_PUBLIC_KEY>
with the public key obtained from NY Times.
-
Node.js & npm: Download and install Node.js.
-
Watchman: A filesystem watch tool by Facebook.
brew install watchman
-
React Native CLI:
npm install -g react-native-cli
-
Xcode & Android Studio:
- Xcode: For iOS development. Available on the App Store.
- Android Studio: For Android development. Download from Android Studio website.
git clone https://github.com/michelazzam/NY-Times.git
cd nytimes
npm install
OR
yarn install
react-native run-ios or npm run ios
For a specific device:
react-native run-ios --simulator="iPhone 11"
Make sure an Android emulator is running or a device is connected:
react-native run-android or npm run android
-
Metro Server: If there's an issue, restart:
react-native start
-
Build Issues: Ensure Xcode and Android Studio are correctly set up. For Android, an emulator or device should be running. For iOS, select an appropriate simulator.
-
Dependencies: If there are issues, delete
node_modules
and eitherpackage-lock.json
oryarn.lock
. Then, runnpm install
oryarn install
.