Skip to content

Commit 84e420c

Browse files
authored
Upgrade example app. (DylanVann#451)
1 parent 4849f2b commit 84e420c

31 files changed

+2067
-1953
lines changed

.prettierignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
ios/Vendor
1+
/ios/Vendor/
2+
/react-native-fast-image-example/
3+
/react-native-fast-image-example-cocoapods/
4+
node_modules
5+
coverage

react-native-fast-image-example/.babelrc

-3
This file was deleted.

react-native-fast-image-example/.flowconfig

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
[libs]
2525
node_modules/react-native/Libraries/react-native/react-native-interface.js
2626
node_modules/react-native/flow/
27-
node_modules/react-native/flow-github/
2827

2928
[options]
3029
emoji=true
@@ -67,4 +66,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
6766
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
6867

6968
[version]
70-
^0.78.0
69+
^0.92.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import 'react-native';
6+
import React from 'react';
7+
import App from '../App';
8+
9+
// Note: test renderer must be required after react-native.
10+
import renderer from 'react-test-renderer';
11+
12+
it('renders correctly', () => {
13+
renderer.create(<App />);
14+
});

react-native-fast-image-example/android/app/BUCK

+4-14
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,13 @@
88
# - `buck install -r android/app` - compile, install and run application
99
#
1010

11+
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12+
1113
lib_deps = []
1214

13-
for jarfile in glob(['libs/*.jar']):
14-
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15-
lib_deps.append(':' + name)
16-
prebuilt_jar(
17-
name = name,
18-
binary_jar = jarfile,
19-
)
15+
create_aar_targets(glob(["libs/*.aar"]))
2016

21-
for aarfile in glob(['libs/*.aar']):
22-
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23-
lib_deps.append(':' + name)
24-
android_prebuilt_aar(
25-
name = name,
26-
aar = aarfile,
27-
)
17+
create_jar_targets(glob(["libs/*.jar"]))
2818

2919
android_library(
3020
name = "all-libs",

react-native-fast-image-example/android/app/build.gradle

+8-17
Original file line numberDiff line numberDiff line change
@@ -95,49 +95,39 @@ def enableProguardInReleaseBuilds = false
9595

9696
android {
9797
compileSdkVersion rootProject.ext.compileSdkVersion
98-
buildToolsVersion rootProject.ext.buildToolsVersion
98+
99+
compileOptions {
100+
sourceCompatibility JavaVersion.VERSION_1_8
101+
targetCompatibility JavaVersion.VERSION_1_8
102+
}
99103

100104
defaultConfig {
101105
applicationId "com.reactnativefastimageexample"
102106
minSdkVersion rootProject.ext.minSdkVersion
103107
targetSdkVersion rootProject.ext.targetSdkVersion
104108
versionCode 1
105109
versionName "1.0"
106-
ndk {
107-
abiFilters "armeabi-v7a", "x86"
108-
}
109-
}
110-
signingConfigs {
111-
release {
112-
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
113-
storeFile file(MYAPP_RELEASE_STORE_FILE)
114-
storePassword MYAPP_RELEASE_STORE_PASSWORD
115-
keyAlias MYAPP_RELEASE_KEY_ALIAS
116-
keyPassword MYAPP_RELEASE_KEY_PASSWORD
117-
}
118-
}
119110
}
120111
splits {
121112
abi {
122113
reset()
123114
enable enableSeparateBuildPerCPUArchitecture
124115
universalApk false // If true, also generate a universal APK
125-
include "armeabi-v7a", "x86"
116+
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
126117
}
127118
}
128119
buildTypes {
129120
release {
130121
minifyEnabled enableProguardInReleaseBuilds
131122
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
132-
signingConfig signingConfigs.release
133123
}
134124
}
135125
// applicationVariants are e.g. debug, release
136126
applicationVariants.all { variant ->
137127
variant.outputs.each { output ->
138128
// For each separate APK per architecture, set a unique version code as described here:
139129
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
140-
def versionCodes = ["armeabi-v7a":1, "x86":2]
130+
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
141131
def abi = output.getFilter(OutputFile.ABI)
142132
if (abi != null) { // null for the universal-debug, universal-release variants
143133
output.versionCodeOverride =
@@ -148,6 +138,7 @@ android {
148138
}
149139

150140
dependencies {
141+
implementation project(':react-native-gesture-handler')
151142
implementation project(':react-native-vector-icons')
152143
implementation project(':react-native-image-picker')
153144
implementation project(':react-native-fast-image')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""Helper definitions to glob .aar and .jar targets"""
2+
3+
def create_aar_targets(aarfiles):
4+
for aarfile in aarfiles:
5+
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6+
lib_deps.append(":" + name)
7+
android_prebuilt_aar(
8+
name = name,
9+
aar = aarfile,
10+
)
11+
12+
def create_jar_targets(jarfiles):
13+
for jarfile in jarfiles:
14+
name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15+
lib_deps.append(":" + name)
16+
prebuilt_jar(
17+
name = name,
18+
binary_jar = jarfile,
19+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
5+
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
6+
7+
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
8+
</manifest>

react-native-fast-image-example/android/app/src/main/AndroidManifest.xml

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.reactnativefastimageexample">
2+
package="com.reactnativefastimageexample">
33

44
<uses-permission android:name="android.permission.INTERNET" />
5-
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
6-
<uses-permission android:name="android.permission.CAMERA" />
7-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
85

96
<application
107
android:name=".MainApplication"
118
android:label="@string/app_name"
129
android:icon="@mipmap/ic_launcher"
10+
android:roundIcon="@mipmap/ic_launcher_round"
1311
android:allowBackup="false"
1412
android:theme="@style/AppTheme">
1513
<activity
Binary file not shown.

react-native-fast-image-example/android/app/src/main/java/com/reactnativefastimageexample/MainApplication.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.app.Application;
44

55
import com.facebook.react.ReactApplication;
6+
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
67
import com.oblador.vectoricons.VectorIconsPackage;
78
import com.imagepicker.ImagePickerPackage;
89
import com.dylanvann.fastimage.FastImageViewPackage;
@@ -26,9 +27,10 @@ public boolean getUseDeveloperSupport() {
2627
protected List<ReactPackage> getPackages() {
2728
return Arrays.<ReactPackage>asList(
2829
new MainReactPackage(),
29-
new VectorIconsPackage(),
30-
new ImagePickerPackage(),
31-
new FastImageViewPackage()
30+
new RNGestureHandlerPackage(),
31+
new VectorIconsPackage(),
32+
new ImagePickerPackage(),
33+
new FastImageViewPackage()
3234
);
3335
}
3436

react-native-fast-image-example/android/build.gradle

+6-12
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
buildscript {
44
ext {
5-
buildToolsVersion = "27.0.3"
5+
buildToolsVersion = "28.0.3"
66
minSdkVersion = 16
7-
compileSdkVersion = 27
8-
targetSdkVersion = 26
9-
supportLibVersion = "27.1.1"
7+
compileSdkVersion = 28
8+
targetSdkVersion = 28
9+
supportLibVersion = "28.0.0"
1010
}
1111
repositories {
1212
google()
1313
jcenter()
1414
}
1515
dependencies {
16-
classpath 'com.android.tools.build:gradle:3.1.4'
16+
classpath 'com.android.tools.build:gradle:3.3.1'
1717

1818
// NOTE: Do not place your application dependencies here; they belong
1919
// in the individual module build.gradle files
@@ -22,18 +22,12 @@ buildscript {
2222

2323
allprojects {
2424
repositories {
25-
google()
2625
mavenLocal()
26+
google()
2727
jcenter()
2828
maven {
2929
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
3030
url "$rootDir/../node_modules/react-native/android"
3131
}
3232
}
3333
}
34-
35-
36-
task wrapper(type: Wrapper) {
37-
gradleVersion = '4.4'
38-
distributionUrl = distributionUrl.replace("bin", "all")
39-
}

react-native-fast-image-example/android/gradle.properties

-5
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,3 @@
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
19-
20-
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
21-
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
22-
MYAPP_RELEASE_STORE_PASSWORD=password123
23-
MYAPP_RELEASE_KEY_PASSWORD=password123

react-native-fast-image-example/android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

react-native-fast-image-example/android/settings.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
rootProject.name = 'ReactNativeFastImageExample'
2+
include ':react-native-gesture-handler'
3+
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
24
include ':react-native-vector-icons'
35
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
46
include ':react-native-image-picker'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ['module:metro-react-native-babel-preset'],
3+
};
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @format */
22

33
import { AppRegistry } from 'react-native'
4-
import App from './src'
54
import { name as appName } from './app.json'
5+
import App from './src'
66

77
AppRegistry.registerComponent(appName, () => App)

0 commit comments

Comments
 (0)