/RNPhotoShare

A sample React Native app showing how to use Imgur and Pusher to implement a realtime photo-sharing app

Primary LanguageJavaScript

RNPhotoShare

A sample React Native app showing how to use Imgur and Pusher to implement a realtime photo-sharing app

Full tutorial is available at: https://pusher.com/tutorials/photo-sharing-react-native

Prerequisites

Getting Started

  1. Clone the repo:
git clone https://github.com/anchetaWern/RNPhotoShare.git
  1. Install the app dependencies:
cd RNPhotoShare
yarn install
  1. Update Pusher config on src/screens/HomeScreen.js file:
componentDidMount() {
    this.pusher = new Pusher("YOUR PUSHER APP KEY", {
      authEndpoint: "YOUR_NGROK_URL/pusher/auth",
      cluster: "YOUR PUSHER APP CLUSTER",
      encrypted: true
    });
}
  1. Add your Imgur app ID on src/screens/ShareScreen.js file:
const response = await fetch("https://api.imgur.com/3/image", {
	method: "POST",
	headers: {
	  Authorization: "Client-ID YOUR_IMGUR_APP_ID"
	},
	body: formData
});
  1. Install the server dependencies:
cd server
npm install
  1. Update the .env file:
APP_ID=YOUR_PUSHER_APP_ID
APP_KEY=YOUR_PUSHER_APP_KEY
APP_SECRET=YOUR_PUSHER_APP_SECRET
APP_CLUSTER=YOUR_PUSHER_APP_CLUSTER
PORT=3000
  1. Run the server:
node server.js
  1. Download ngrok executable file.

  2. Expose server using ngrok:

./ngrok authtoken YOUR_NGROK_AUTH_TOKEN
./ngrok http 3000
  1. Copy the ngrok https URL and update the authEndpoint in the src/screens/HomeScreen.js file.

  2. Run the app and open it in your Expo client app:

expo start

Built With