-
Notifications
You must be signed in to change notification settings - Fork 0
/
react native steps
145 lines (112 loc) · 4.05 KB
/
react native steps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
Create new project
========================================
npx react-native init Timestamping
google-services.json
===========================
Check if project url is present else add:
"firebase_url": "https://timestamps-aaddf-default-rtdb.firebaseio.com"
changes in MainActivity.java
======================================
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
Vector icons not showing
===================================
react-native link react-native-vector-icons
In AndroidManifest.xml
=================================
NFC related changes
<uses-permission android:name="android.permission.NFC" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="timestamp" android:host="toggle"/>
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED"/>
</intent-filter>
FB Login related changes(will be told in setup wizard):
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
FB Login related changes In strings.xml(will be told in setup wizard)
====================================
<string name="facebook_app_id">209034510719349</string>
<string name="fb_login_protocol_scheme">fb209034510719349</string>
Key Hash for Facebook Login
==========================================
keytool -exportcert -alias timestamp -keystore "C:\Users\dhruv.pandey\Desktop\hackathon\Timestamping\android\app\debug.keystore" | openssl sha1 -binary | openssl base64
Keystore pass: android
Gradle related changes(quite important and confusing)
=========================================================
For Firebase DB(Given in setup wizard):
Project-level build.gradle (<project>/build.gradle):
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
dependencies {
...
// Add this line
classpath 'com.google.gms:google-services:4.3.5'
}
}
allprojects {
...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
...
}
}
App-level build.gradle (<project>/<app-module>/build.gradle):
apply plugin: 'com.android.application'
// Add this line
apply plugin: 'com.google.gms.google-services'
dependencies {
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:27.1.0')
implementation 'com.google.firebase:firebase-database'
// Add the dependencies for the desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries
}
For FB Login:
Project-level build.gradle (<project>/build.gradle):
buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
ndkVersion = "20.1.5948944"
}
repositories {
mavenCentral() //ADD THIS
google()
jcenter()
}
App-level build.gradle (<project>/<app-module>/build.gradle):
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.facebook.android:facebook-android-sdk:[5,6)' //ADD THIS
Start Metro server
=============================
react-native start --port=8088
Run App
==================
react-native run-android --port=8088