Skip to content

honestbonsai/DrizzleReactNative

Repository files navigation

reactNativeDrizzle

This repo is a proof of concept for getting Drizzle to work on React Native.

Setup

Common

  1. Install dependencies: yarn
  2. Install ganache-cli globally: npm install -g ganache-cli
  3. Install truffle globally: npm install -g truffle
  4. Start React Native Metro bundler: react-native start
  5. Start your emulator/plug in your device

Android

  1. Start ganache-cli: ganache-cli -b 3
  2. Compile and migrate contracts: yarn run setup
  3. Do steps for Testing Dynamically Added Contract
  4. Install app: react-native run-android

iOS

Simulator

  1. Start ganache-cli: ganache-cli -b 3
  2. Compile and migrate contracts: truffle compile && truffle migrate
  3. Do steps for Testing Dynamically Added Contract
  4. Install app: Do it through Xcode

Physical device

  1. Find your LOCAL_MACHINE_IP by checking your network settings on your Mac where Ganache is running
  2. Start ganache-cli: ganache-cli -b 3 -h LOCAL_MACHINE_IP
  3. In ./truffle.js for development, point Truffle to LOCAL_MACHINE_IP
  4. Compile and migrate contracts: truffle compile && truffle migrate
  5. In ./app/core/Core.js, point Drizzle to LOCAL_MACHINE_IP
    const options = {
      ...
      web3: {
        fallback: {
          type: "ws",
          url: "ws://192.168.0.107:8545"
        }
      }
    };
    
  6. Do steps for Testing Dynamically Added Contract
  7. Install: Do it through Xcode

Testing Dynamically Added Contract

  1. In a different Truffle project, deploy another version of TutorialToken (or any token with the method totalSupply) to your Ganache testnet: truffle compile && truffle migrate
  2. Copy the address that the contract was deployed to
  3. Paste the address into the variable address in app/examples/DynamicContract.js

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published