A Pet Adoption App -- ReactNative
git clone https://github.com/addyh/pinder.git
cd pinder
npm install
First of all, before anything, please note that the URIs to pets.json
and settings.json
are set in:
/ API_CONFIG.json
Make sure an Android/iOS device is connected or the emulator is running.
-
With React-Native-cli:
npm install -g react-native-cli
- For Windows / Android dev:
react-native run-android --variant=release
- For MacOS / iPhone dev:
react-native run-ios --configuration Release
- For Windows / Android dev:
-
Build With Android Studio
- Start the react native Metro server:
react-native start
- Then press the green "Run" (play button) to build and run in Android Studio.
- Start the react native Metro server:
-
Build With XCode
- Open the iOS project
ios/pinder.xcodeproj
with Xcode. - Then press the green "Run" (play button) to build and run in Xcode.
- Open the iOS project
-
Build with gradle
cd android && ./gradlew assembleRelease
cd android && gradlew.bat assembleRelease
on Windows- The apk will be saved to
./android/app/build/outputs/apk/app-release.apk
- .env - (build version etc.)
- API_CONFIG.json - SET API URLS HERE (pets.json and settings.json)
- index.js - (main js file)
- /app/
- /actions/
- petsActions.js
- exports
fetchPets()
- (get the list of pets for the first time)fetchImages()
- (go through each pet image)saveImage()
- (and save it locally, for faster image loading)
- exports
addSavedPet()
- (user swiped right on a pet)
- exports
- settingsActions.js
- exports
fetchSettings()
- (get the user settings for the first time) - exports
updateProfile()
- (dispatch to update settings state) - exports
updateAgeMin()
- (dispatch to update settings state) - exports
updateAgeMax()
- (dispatch to update settings state) - exports
updateTypePreference()
- (dispatch to update settings state)
- exports
- types.js
- petsActions.js
- /components/ - All screens/pages of the app are their own Component
- HomeScreen.js - (a container for all pages and the navigation)
- NavBarBottom.js - (the nav bar at the bottom of all pages)
- PetInfoModal.js - (pet info modal page)
- SavedScreen.js - ("Saved" Page)
- SearchScreen.js - ("Search" Page)
- SettingsScreen.js - ("Settings" Page)
- /reducers/
- index.js
- petsReducer.js
- FETCH_ALL_PETS - (get
state.pets.allPets
) - SET_IMG_SRC - (create property
state.pets.allPets[n].src
-- a local copy of the image file) - ADD_SAVED_PET - (add a pet to
state.pets.savedPets
)
- FETCH_ALL_PETS - (get
- settingsReducer.js
- FETCH_SETTINGS - (get
state.settings
) - UPDATE_PROFILE - (update
state.settings.profile
) - UPDATE_AGE_MIN - (update
state.settings.age.min
) - UPDATE_AGE_MAX - (update
state.settings.age.max
) - UPDATE_TYPE_PREFERENCE - (update
state.settings.typePreference
)
- FETCH_SETTINGS - (get
- /styles/
- colors.js
- App.js - (main App file)
- store.js - (Redux store file)
- /actions/