Skip to content

efefurkankarakaya/library-app

Repository files navigation

Library App

A book library application built on React Native and Realm.

Technologies

Dependencies

How To Run?

On Emulator

  • Run $ npm install to install dependencies.
  • Then $ npm run {ios | android} to run application on specified platform.

On Real Device

  • Run $ npm install to install dependencies.
  • Connect mobile device via USB and make sure USB Debugging is allowed on your phone.
  • Then $ npm run {ios | android} --localhost

Possible Problems and Solutions

$ npm run android → android/gradlew exited with non-zero code: 1

Probably, you have a different version of JDK than expected. According to the documentation, the most compatible and suggested version is JDK11.

You can find the JDK11 installer by clicking here.

$ npm run android → Build failed: SDK location not found.

  • Create a file named local.properties under android/ folder in project.
  • Set inside sdk.dir = {YOUR_SDK_PATH}
  • Then run $ npm run android

$ npx expo start → Missing Realm constructor.

 ERROR  Error: Missing Realm constructor. Did you run "pod install"? Please see https://docs.mongodb.com/realm/sdk/react-native/install/ for troubleshooting, js engine: hermes

 ERROR  Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

In a Realm project, you can't use $ npx expo start. Realm uses customized native codes and because of that it requires platform builds. This command does not create builds (also does not use existing ones) and that explains why it fails.

You need to run the project using by
$ npx expo run:ios
or
$ npx expo run:android

In package.json these scripts are already defined like below:
$ npm run ios$ npx expo run:ios
$ npm run android$ npx expo run:android

Feel free to use both ways, but don't forget to use the correct scripts which create and use the platform builds.

Registration

As a Privileged User (aka: SU, Super User)

All you need to do is using an e-mail address that ends with @protonmail.com

As a Regular User

Just sign up with an e-mail address that does not end with @protonmail.com

Use Cases

Case 1: Librarian

Consider that you are a librarian, you need to create entries of books.

You should be able to:

  • Access to full CRUD operations (create, read, update and delete) for books.
  • Upload image.
  • Take photograph.
  • Change image of a book.
  • Change any detail of book.
  • Save changes.

Therefore, a basic case should be like:

  • User signs up with an e-mail address that ends with @protonmail.com to be privileged user.
  • User logs in.
  • User swipes right to create a new book.
  • User takes a photograph of a book.
  • User enters details of the book.
  • User saves the book.
  • User sees the book in home, and keep goes create new books.
  • User swipes right again.
  • User picks an book image from gallery.
  • User enters details of the book.
    ...

Case 2: Regular Library User

Consider that you are a user of a library application and you want to borrow some books.

You should be able to:

  • Access book data.
  • Borrow or put back books.

Therefore, a basic case should be like:

  • User signs up with their personal information.
  • User logs in and sees the books.
  • User taps on a book that interested in.
  • User taps on Borrow button.
    ... (after a while)
  • User wants to return the book, logs in the app.
  • User goes to My Books screen.
  • User taps on the book, that they want to return.
  • User taps on Put Back button in detail screen.

Screenshots

Login

Sign Up

Sign Up (onChange)

Sign Up (onSubmit)

Home

Details (w/ SU Privileges)

My Books (Borrowed)

Camera (Requires SU Privileges)

Camera (onImagePick)