Skip to content

Commit 7e412ef

Browse files
committed
Example is updated: RN 0.64.1
1 parent 6d3dcdc commit 7e412ef

File tree

20 files changed

+3230
-3121
lines changed

20 files changed

+3230
-3121
lines changed

example/.eslintrc.js

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,4 @@
11
module.exports = {
2-
parser: "babel-eslint",
3-
extends: "airbnb",
4-
plugins: ["react", "react-native"],
5-
env: {
6-
jest: true,
7-
"react-native/react-native": true
8-
},
9-
rules: {
10-
// allow js file extension
11-
"react/jsx-filename-extension": [
12-
"error",
13-
{
14-
extensions: [".js", ".jsx"]
15-
}
16-
],
17-
// for post defining style object in react-native
18-
"no-use-before-define": ["error", { variables: false }],
19-
// react-native rules
20-
"react-native/no-unused-styles": 2,
21-
"react-native/split-platform-components": 2,
22-
"react-native/no-inline-styles": 2,
23-
"react-native/no-raw-text": 2
24-
}
2+
root: true,
3+
extends: '@react-native-community',
254
};

example/.flowconfig

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55
; Ignore "BUCK" generated dirs
66
<PROJECT_ROOT>/\.buckd/
77

8-
; Ignore unexpected extra "@providesModule"
9-
.*/node_modules/.*/node_modules/fbjs/.*
10-
11-
; Ignore duplicate module providers
12-
; For RN Apps installed via npm, "Libraries" folder is inside
13-
; "node_modules/react-native" but in the source repo it is in the root
14-
node_modules/react-native/Libraries/react-native/React.js
15-
168
; Ignore polyfills
179
node_modules/react-native/Libraries/polyfills/.*
1810

@@ -21,7 +13,7 @@ node_modules/react-native/Libraries/polyfills/.*
2113
node_modules/warning/.*
2214

2315
; Flow doesn't support platforms
24-
.*/Libraries/Utilities/HMRLoadingView.js
16+
.*/Libraries/Utilities/LoadingView.js
2517

2618
[untyped]
2719
.*/node_modules/@react-native-community/cli/.*/.*
@@ -42,27 +34,11 @@ module.file_ext=.js
4234
module.file_ext=.json
4335
module.file_ext=.ios.js
4436

45-
module.system=haste
46-
module.system.haste.use_name_reducers=true
47-
# get basename
48-
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
49-
# strip .js or .js.flow suffix
50-
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
51-
# strip .ios suffix
52-
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
53-
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
54-
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
55-
module.system.haste.paths.blacklist=.*/__tests__/.*
56-
module.system.haste.paths.blacklist=.*/__mocks__/.*
57-
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
58-
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
59-
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
60-
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
61-
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
62-
6337
munge_underscores=true
6438

65-
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
39+
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
40+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
41+
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
6642

6743
suppress_type=$FlowIssue
6844
suppress_type=$FlowFixMe
@@ -96,4 +72,4 @@ untyped-import
9672
untyped-type-import
9773

9874
[version]
99-
^0.98.0
75+
^0.105.0

example/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ DerivedData
2020
*.hmap
2121
*.ipa
2222
*.xcuserstate
23-
project.xcworkspace
2423

2524
# Android/IntelliJ
2625
#
@@ -40,6 +39,7 @@ yarn-error.log
4039
buck-out/
4140
\.buckd/
4241
*.keystore
42+
!debug.keystore
4343

4444
# fastlane
4545
#

example/App.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import Icon from "react-native-dynamic-vector-icons";
1515
const App = () => {
1616
return (
1717
<Fragment>
18-
<StatusBar barStyle="dark-content" />
18+
<StatusBar barStyle="light-content" />
1919
<SafeAreaView>
2020
{/* <ClassicHeader
2121
statusBarHidden
@@ -29,8 +29,8 @@ const App = () => {
2929
</TouchableOpacity>
3030
}
3131
/> */}
32-
<ModernHeader />
33-
{/* <AppleHeader /> */}
32+
{/* <ModernHeader /> */}
33+
<AppleHeader />
3434
</SafeAreaView>
3535
</Fragment>
3636
);

example/android/app/build.gradle

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -176,27 +176,18 @@ android {
176176

177177
}
178178
}
179-
180-
packagingOptions {
181-
pickFirst '**/armeabi-v7a/libc++_shared.so'
182-
pickFirst '**/x86/libc++_shared.so'
183-
pickFirst '**/arm64-v8a/libc++_shared.so'
184-
pickFirst '**/x86_64/libc++_shared.so'
185-
pickFirst '**/x86/libjsc.so'
186-
pickFirst '**/armeabi-v7a/libjsc.so'
187-
}
188179
}
189180

190181
dependencies {
191182
implementation fileTree(dir: "libs", include: ["*.jar"])
192183
implementation "com.facebook.react:react-native:+" // From node_modules
193184

194185
if (enableHermes) {
195-
def hermesPath = "../../node_modules/hermesvm/android/";
196-
debugImplementation files(hermesPath + "hermes-debug.aar")
197-
releaseImplementation files(hermesPath + "hermes-release.aar")
186+
def hermesPath = "../../node_modules/hermes-engine/android/";
187+
debugImplementation files(hermesPath + "hermes-debug.aar")
188+
releaseImplementation files(hermesPath + "hermes-release.aar")
198189
} else {
199-
implementation jscFlavor
190+
implementation jscFlavor
200191
}
201192
}
202193

example/android/app/debug.keystore

2.2 KB
Binary file not shown.

example/android/app/src/main/java/com/example/MainActivity.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
public class MainActivity extends ReactActivity {
66

7-
/**
8-
* Returns the name of the main component registered from JavaScript.
9-
* This is used to schedule rendering of the component.
10-
*/
11-
@Override
12-
protected String getMainComponentName() {
13-
return "example";
14-
}
7+
/**
8+
* Returns the name of the main component registered from JavaScript. This is used to schedule
9+
* rendering of the component.
10+
*/
11+
@Override
12+
protected String getMainComponentName() {
13+
return "example";
14+
}
1515
}
Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
11
package com.example;
22

33
import android.app.Application;
4-
import android.util.Log;
5-
4+
import android.content.Context;
65
import com.facebook.react.PackageList;
7-
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
8-
import com.facebook.react.bridge.JavaScriptExecutorFactory;
96
import com.facebook.react.ReactApplication;
107
import com.facebook.react.ReactNativeHost;
118
import com.facebook.react.ReactPackage;
129
import com.facebook.soloader.SoLoader;
13-
10+
import java.lang.reflect.InvocationTargetException;
1411
import java.util.List;
1512

1613
public class MainApplication extends Application implements ReactApplication {
1714

18-
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
19-
@Override
20-
public boolean getUseDeveloperSupport() {
21-
return BuildConfig.DEBUG;
22-
}
15+
private final ReactNativeHost mReactNativeHost =
16+
new ReactNativeHost(this) {
17+
@Override
18+
public boolean getUseDeveloperSupport() {
19+
return BuildConfig.DEBUG;
20+
}
2321

24-
@Override
25-
protected List<ReactPackage> getPackages() {
26-
@SuppressWarnings("UnnecessaryLocalVariable")
27-
List<ReactPackage> packages = new PackageList(this).getPackages();
28-
// Packages that cannot be autolinked yet can be added manually here, for example:
29-
// packages.add(new MyReactNativePackage());
30-
return packages;
31-
}
22+
@Override
23+
protected List<ReactPackage> getPackages() {
24+
@SuppressWarnings("UnnecessaryLocalVariable")
25+
List<ReactPackage> packages = new PackageList(this).getPackages();
26+
// Packages that cannot be autolinked yet can be added manually here, for example:
27+
// packages.add(new MyReactNativePackage());
28+
return packages;
29+
}
3230

33-
@Override
34-
protected String getJSMainModuleName() {
35-
return "index";
36-
}
37-
};
31+
@Override
32+
protected String getJSMainModuleName() {
33+
return "index";
34+
}
35+
};
3836

3937
@Override
4038
public ReactNativeHost getReactNativeHost() {
@@ -45,5 +43,32 @@ public ReactNativeHost getReactNativeHost() {
4543
public void onCreate() {
4644
super.onCreate();
4745
SoLoader.init(this, /* native exopackage */ false);
46+
initializeFlipper(this); // Remove this line if you don't want Flipper enabled
47+
}
48+
49+
/**
50+
* Loads Flipper in React Native templates.
51+
*
52+
* @param context
53+
*/
54+
private static void initializeFlipper(Context context) {
55+
if (BuildConfig.DEBUG) {
56+
try {
57+
/*
58+
We use reflection here to pick up the class that initializes Flipper,
59+
since Flipper library is not available in release mode
60+
*/
61+
Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
62+
aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
63+
} catch (ClassNotFoundException e) {
64+
e.printStackTrace();
65+
} catch (NoSuchMethodException e) {
66+
e.printStackTrace();
67+
} catch (IllegalAccessException e) {
68+
e.printStackTrace();
69+
} catch (InvocationTargetException e) {
70+
e.printStackTrace();
71+
}
72+
}
4873
}
4974
}

example/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ buildscript {
66
minSdkVersion = 16
77
compileSdkVersion = 28
88
targetSdkVersion = 28
9-
supportLibVersion = "28.0.0"
109
}
1110
repositories {
1211
google()
1312
jcenter()
1413
}
1514
dependencies {
16-
classpath("com.android.tools.build:gradle:3.4.1")
15+
classpath("com.android.tools.build:gradle:3.4.2")
1716

1817
// NOTE: Do not place your application dependencies here; they belong
1918
// in the individual module build.gradle files
@@ -34,5 +33,6 @@ allprojects {
3433

3534
google()
3635
jcenter()
36+
maven { url 'https://jitpack.io' }
3737
}
3838
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)