Skip to content

Commit

Permalink
feat: Upgrade to React Native 0.60.0 / CocoaPods / Android X. (#513)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: You should upgrade React Native. See https://facebook.github.io/react-native/blog/2019/07/03/version-60
  • Loading branch information
DylanVann authored Jul 5, 2019
1 parent df76905 commit 5489f9e
Show file tree
Hide file tree
Showing 221 changed files with 3,853 additions and 15,592 deletions.
9 changes: 0 additions & 9 deletions .gitmodules

This file was deleted.

16 changes: 2 additions & 14 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,9 @@ android/build
ios/build
react-native-fast-image-*.tgz

# We need to ignore some things in submodules.
# This probably isn't everything we'd like to ignore but it's good enough.
.git*
*.png
ios/Vendor/SDWebImage/Examples
ios/Vendor/SDWebImage/Tests
ios/Vendor/SDWebImage/Docs
ios/Vendor/SDWebImage/Vendors/FLAnimatedImage/FLAnimatedImageDemo
ios/Vendor/SDWebImage/Vendors/FLAnimatedImage/images
ios/Vendor/SDWebImage/Vendors/libwebp/examples

# Examples
react-native-fast-image-example
react-native-fast-image-example-cocoapods
react-native-fast-image-example-server
ReactNativeFastImageExample
ReactNativeFastImageExampleServer

# Tests
.circleci
Expand Down
5 changes: 2 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/ios/Vendor/
/react-native-fast-image-example/
/react-native-fast-image-example-cocoapods/
/ReactNativeFastImageExample/
/ReactNativeFastImageExampleServer/
node_modules
coverage
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,11 @@ const YourImage = () => (
)
```

## Other Linking Methods
## Are you using Glide already using an AppGlideModule?

- [Manual](docs/installation-manual.md) (might be needed if something went wrong with `react-native link`)
- [CocoaPods (iOS)](docs/installation-cocoapods.md) (you may wish to use this if you are already using CocoaPods)
- [Are you using Glide already using an AppGlideModule?](docs/app-glide-module.md) (you might have problems if you don't read this)

## Proguard
## Are you using Proguard?

If you use Proguard you will need to add these lines to `android/app/proguard-rules.pro`:

Expand Down
21 changes: 21 additions & 0 deletions RNFastImage.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require 'json'

Pod::Spec.new do |s|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

s.name = "RNFastImage"
s.version = package['version']
s.summary = package['description']
s.authors = { "Dylan Vann" => "dylan@dylanvann.com" }
s.homepage = "https://github.com/DylanVann/react-native-fast-image#readme"
s.license = "MIT"
s.platforms = { :ios => "8.0", :tvos => "9.0" }
s.framework = 'UIKit'
s.requires_arc = true
s.source = { :git => "https://github.com/DylanVann/react-native-fast-image.git" }
s.source_files = "ios/**/*.{h,m}"

s.dependency 'React'
s.dependency 'SDWebImage', '~> 5.0'
s.dependency 'SDWebImageWebPCoder', '~> 0.2.3'
end
File renamed without changes.
4 changes: 4 additions & 0 deletions ReactNativeFastImageExample/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@
; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
node_modules/react-native/Libraries/react-native/React.js

; Ignore polyfills
.*/Libraries/polyfills/.*
node_modules/react-native/Libraries/polyfills/.*

; Ignore metro
.*/node_modules/metro/.*
; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
node_modules/warning/.*

; Flow doesn't support platforms
.*/Libraries/Utilities/HMRLoadingView.js

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*

[include]

Expand All @@ -31,6 +38,10 @@ emoji=true
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable

module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js

module.system=haste
module.system.haste.use_name_reducers=true
# get basename
Expand All @@ -43,27 +54,46 @@ module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*

munge_underscores=true

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'

module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
sketchy-number=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
inexact-spread=warn
unnecessary-invariant=warn
signature-verification-failure=warn
deprecated-utility=error

[strict]
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import

[version]
^0.92.0
^0.98.0
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ buck-out/

# Bundle artifact
*.jsbundle

# CocoaPods
/ios/Pods/
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import com.android.build.OutputFile
* // the entry file for bundle generation
* entryFile: "index.android.js",
*
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
* bundleCommand: "ram-bundle",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
Expand Down Expand Up @@ -93,6 +96,15 @@ def enableSeparateBuildPerCPUArchitecture = false
*/
def enableProguardInReleaseBuilds = false

/**
* Use international variant JavaScriptCore
* International variant includes ICU i18n library and necessary data allowing to use
* e.g. Date.toLocaleString and String.localeCompare that give correct results
* when using with locales other than en-US.
* Note that this variant is about 6MiB larger per architecture than default.
*/
def useIntlJsc = false

android {
compileSdkVersion rootProject.ext.compileSdkVersion

Expand All @@ -116,8 +128,22 @@ android {
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
Expand All @@ -126,8 +152,8 @@ android {
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
Expand All @@ -138,13 +164,15 @@ android {
}

dependencies {
implementation project(':react-native-gesture-handler')
implementation project(':react-native-vector-icons')
implementation project(':react-native-image-picker')
implementation project(':react-native-fast-image')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules

// JSC from node_modules
if (useIntlJsc) {
implementation 'org.webkit:android-jsc-intl:+'
} else {
implementation 'org.webkit:android-jsc:+'
}
}

// Run this once to be able to run the application with BUCK
Expand All @@ -153,3 +181,6 @@ task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,3 @@
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.reactnativefastimageexamplecocoapods;
package com.reactnativefastimageexample;

import android.app.Application;

import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;

import java.util.Arrays;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {
Expand All @@ -21,9 +20,11 @@ public boolean getUseDeveloperSupport() {

@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
);
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath("com.android.tools.build:gradle:3.4.1")

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -23,11 +23,16 @@ buildscript {
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}

google()
jcenter()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

android.useAndroidX=true
android.enableJetifier=true
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down
Loading

0 comments on commit 5489f9e

Please sign in to comment.