You can use this template as a refrence to start react-native app.
To run this project first install react-native CLI
Run npm install -g create-react-native-app
Download or Clone this repo https://github.com/Ravi448/react-native-starter-app.git
Run npm install
To run this project for android, navigate to project directory then android and open local.properties
file and change your
sdk path
Run react-native run-android
To run on iOS, You must have to install Xcode on your mac.
Run rect-native run-ios
If you face issue to build in android due to camera component, please follow the steps to install camera component from npm install react-native-camera --save
Then link the component to react native: react-native link react-native-camera
Now:
Navigate to android/build.gradle
and add following code:
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
Navigate to node_modules/react-native-camera/android/build.gradle
and remove or comment google()
Now your code will look like:
buildscript {
repositories {
jcenter()
// google()
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
Now at the bottom of the above build.gradle file:
Change compileOnly
to provided
& implementation
to compile
Now this will look like:
dependencies {
def googlePlayServicesVersion = rootProject.hasProperty('googlePlayServicesVersion') ? rootProject.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION
def supportLibVersion = rootProject.hasProperty('supportLibVersion') ? rootProject.supportLibVersion : DEFAULT_SUPPORT_LIBRARY_VERSION
provided 'com.facebook.react:react-native:+'
provided 'com.facebook.infer.annotation:infer-annotation:+'
compile "com.google.zxing:core:3.2.1"
compile "com.drewnoakes:metadata-extractor:2.9.1"
compile "com.google.android.gms:play-services-vision:$googlePlayServicesVersion"
compile "com.android.support:exifinterface:$supportLibVersion"
compile "com.android.support:support-annotations:$supportLibVersion"
compile "com.android.support:support-v4:$supportLibVersion"
}
Navigate to android/app/build.gradle
and set compileSdkVersion 26
Add
project.ext.react = [
entryFile: "index.js",
bundleAssetName: "index.android.bundle",
bundleInAlpha: true,
bundleInBeta: true
]
in build.gradle before line: apply from: "../../node_modules/react-native/react.gradle"
If you still face any issue, please add an issue.
Author : Ravi KUMAR
Standard Licence: MIT
Privacy : NONE
Usablity: Everyone