Skip to content

michelazzam/NYTimes

Repository files navigation

NY Times React Native Project

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.

Directory Structure

/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

Essential

.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.

Prerequisites

  1. Node.js & npm: Download and install Node.js.

  2. Watchman: A filesystem watch tool by Facebook.

    brew install watchman
  3. React Native CLI:

    npm install -g react-native-cli
  4. Xcode & Android Studio:

    • Xcode: For iOS development. Available on the App Store.
    • Android Studio: For Android development. Download from Android Studio website.

Getting Started

1. Clone the Repository

git clone https://github.com/michelazzam/NY-Times.git
cd nytimes

2. Install Dependencies

npm install

OR

yarn install

3. Run on iOS

react-native run-ios or npm run ios

For a specific device:

react-native run-ios --simulator="iPhone 11"

4. Run on Android

Make sure an Android emulator is running or a device is connected:

react-native run-android or npm run android

Troubleshooting

  • 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 either package-lock.json or yarn.lock. Then, run npm install or yarn install.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published