Skip to content

Commit

Permalink
Update react-native to 0.61.4 (react-native-share#637)
Browse files Browse the repository at this point in the history
* Update react-native to 0.61.4

* Fix ESLint errors and warnings

* Mark everything in node_modules untyped
  • Loading branch information
friederbluemle authored and jgcmarins committed Nov 27, 2019
1 parent c7287a3 commit 1b3d315
Show file tree
Hide file tree
Showing 34 changed files with 1,366 additions and 681 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
example/
4 changes: 4 additions & 0 deletions example/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
};
79 changes: 40 additions & 39 deletions example/.flowconfig
Original file line number Diff line number Diff line change
@@ -1,75 +1,76 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js
.*/*[.]ios.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*
; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*

; 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
; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
node_modules/warning/.*

; Ignore polyfills
.*/Libraries/polyfills/.*
; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js

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

[include]
../

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/

[options]
server.max_workers=4
emoji=true

esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable

module.system=haste
module.system.haste.use_name_reducers=true
# get basename
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
# strip .js or .js.flow suffix
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
# strip .ios suffix
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
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.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js

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
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
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'

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

[untyped]
.*/node_modules/.*
[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.98.1
^0.105.0
9 changes: 6 additions & 3 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#
.DS_Store

.vscode
# Xcode
#
build/
Expand All @@ -21,8 +20,6 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
ios/Pods

# Android/IntelliJ
#
Expand All @@ -42,6 +39,7 @@ yarn-error.log
buck-out/
\.buckd/
*.keystore
!debug.keystore

# fastlane
#
Expand All @@ -56,3 +54,8 @@ buck-out/

# Bundle artifact
*.jsbundle

# CocoaPods
/ios/Pods/

.vscode
6 changes: 6 additions & 0 deletions example/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
bracketSpacing: false,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
};
2 changes: 1 addition & 1 deletion example/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
10 changes: 5 additions & 5 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

import React, {useState} from 'react';

import {
Alert,
Button,
Expand All @@ -18,15 +17,12 @@ import {
View,
} from 'react-native';

// eslint-disable-next-line import/default
import Share from 'react-native-share';

import images from './images/imagesBase64';

const App = () => {
// eslint-disable-next-line no-undef
const [packageSearch, setPackageSearch] = useState<string>('');
// eslint-disable-next-line no-undef
const [result, setResult] = useState<string>('');

/**
Expand Down Expand Up @@ -148,7 +144,7 @@ const App = () => {
</View>
</View>
)}
<Text style={{marginTop: 20, fontSize: 20}}>Result</Text>
<Text style={styles.resultTitle}>Result</Text>
<Text style={styles.result}>{result}</Text>
</View>
</View>
Expand All @@ -175,6 +171,10 @@ const styles = StyleSheet.create({
textAlign: 'center',
margin: 10,
},
resultTitle: {
marginTop: 20,
fontSize: 20,
},
result: {
fontSize: 14,
margin: 10,
Expand Down
4 changes: 2 additions & 2 deletions example/__tests__/Failed.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'react-native';
import React from 'react';
import { render } from 'react-native-testing-library';
import {render} from 'react-native-testing-library';

import Failed from '../components/Failed';

it('renders correctly', () => {
const x = render(<Failed />).toJSON();
expect(x).toMatchSnapshot();
});
});
4 changes: 2 additions & 2 deletions example/__tests__/Succeed.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'react-native';
import React from 'react';
import { render } from 'react-native-testing-library';
import {render} from 'react-native-testing-library';

import Succeed from '../components/Succeed';

it('renders correctly', () => {
const x = render(<Succeed />).toJSON();
expect(x).toMatchSnapshot();
});
});
48 changes: 28 additions & 20 deletions example/android/app/build.gradle
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 @@ -74,7 +77,7 @@ import com.android.build.OutputFile

project.ext.react = [
entryFile: "index.js",
enableHermes: false, // clean and rebuild if changing
enableHermes: false, // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"
Expand All @@ -89,6 +92,11 @@ apply from: "../../node_modules/react-native/react.gradle"
*/
def enableSeparateBuildPerCPUArchitecture = false

/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false

/**
* The preferred build flavor of JavaScriptCore.
*
Expand All @@ -109,12 +117,7 @@ def jscFlavor = 'org.webkit:android-jsc:+'
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false)

/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
def enableHermes = project.ext.react.get("enableHermes", false);

android {
compileSdkVersion rootProject.ext.compileSdkVersion
Expand All @@ -139,8 +142,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 @@ -149,23 +166,15 @@ 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 =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}

packagingOptions {
pickFirst '**/armeabi-v7a/libc++_shared.so'
pickFirst '**/x86/libc++_shared.so'
pickFirst '**/arm64-v8a/libc++_shared.so'
pickFirst '**/x86_64/libc++_shared.so'
pickFirst '**/x86/libjsc.so'
pickFirst '**/armeabi-v7a/libjsc.so'
}
}
}

Expand All @@ -174,7 +183,7 @@ dependencies {
implementation "com.facebook.react:react-native:+" // From node_modules

if (enableHermes) {
def hermesPath = "../../node_modules/hermesvm/android/";
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
Expand All @@ -190,4 +199,3 @@ task copyDownloadableDepsToLibs(type: Copy) {
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

Binary file added example/android/app/debug.keystore
Binary file not shown.
7 changes: 0 additions & 7 deletions example/android/app/proguard-rules.pro
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 *;
#}
6 changes: 2 additions & 4 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example">
package="com.example">

<uses-permission android:name="android.permission.INTERNET" />

Expand All @@ -10,8 +9,7 @@
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
public class MainActivity extends ReactActivity {

/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
Expand Down
Loading

0 comments on commit 1b3d315

Please sign in to comment.