Commit 4ce9022f authored by Gijs Hendriksen's avatar Gijs Hendriksen
Browse files

Merge branch 'react-native-upgrade' into 'master'

Update react native to 0.58

Closes #78

See merge request !231
parents c2fc902a 6bb742af
{
"presets": ["react-native", "module:react-native-dotenv"],
"plugins": ["@babel/plugin-proposal-object-rest-spread", "@babel/transform-regenerator"]
}
\ No newline at end of file
image: node:8-alpine image: mhart/alpine-node:10
variables: variables:
GRADLE_USER_HOME: $CI_PROJECT_DIR/.gradle GRADLE_USER_HOME: $CI_PROJECT_DIR/.gradle
...@@ -10,6 +10,7 @@ stages: ...@@ -10,6 +10,7 @@ stages:
eslint: eslint:
stage: validate stage: validate
before_script: before_script:
- apk update && apk add git
- yarn install - yarn install
script: script:
- yarn lint:ci - yarn lint:ci
...@@ -17,6 +18,7 @@ eslint: ...@@ -17,6 +18,7 @@ eslint:
jest: jest:
stage: validate stage: validate
before_script: before_script:
- apk update && apk add git
- yarn install - yarn install
script: script:
- yarn jest - yarn jest
...@@ -47,9 +49,11 @@ build android: ...@@ -47,9 +49,11 @@ build android:
- $CI_PROJECT_DIR/.gradle/wrapper/ - $CI_PROJECT_DIR/.gradle/wrapper/
- $CI_PROJECT_DIR/.gradle/caches/ - $CI_PROJECT_DIR/.gradle/caches/
before_script: before_script:
- sysctl fs.inotify.max_user_watches=524288
- set +o pipefail - set +o pipefail
- yes | /opt/android-sdk-linux/tools/bin/sdkmanager --licenses - yes | /opt/android-sdk-linux/tools/bin/sdkmanager --licenses
- set -o pipefail - set -o pipefail
- apk update && apk add git
- yarn install - yarn install
script: script:
- echo $SENTRY_PROPS | base64 -d > ./android/sentry.properties - echo $SENTRY_PROPS | base64 -d > ./android/sentry.properties
...@@ -60,4 +64,4 @@ build android: ...@@ -60,4 +64,4 @@ build android:
paths: paths:
- $CI_PROJECT_DIR/android/app/build/outputs/apk/debug/app-debug.apk - $CI_PROJECT_DIR/android/app/build/outputs/apk/debug/app-debug.apk
- $CI_PROJECT_DIR/android/app/build/outputs/apk/release/app-release-unsigned.apk - $CI_PROJECT_DIR/android/app/build/outputs/apk/release/app-release-unsigned.apk
- $CI_PROJECT_DIR/android/app/build/outputs/apk/release/app-release.apk - $CI_PROJECT_DIR/android/app/build/outputs/apk/release/app-release.apk
\ No newline at end of file
import React from 'react'; import React from 'react';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
import configureStore from 'redux-mock-store'
import MemberView from '../../../../app/ui/components/memberView/MemberView'; import MemberView from '../../../../app/ui/components/memberView/MemberView';
import reducer from '../../../../app/reducers/index';
jest.mock('react-navigation', () => ({ jest.mock('react-navigation', () => ({
withNavigation: component => component, withNavigation: component => component,
})); }));
describe('MemberView component', () => { describe('MemberView component', () => {
const mockStore = configureStore(reducer);
const initialState = { const initialState = {
session: { session: {
token: 'token123', token: 'token123',
}, },
}; };
const store = mockStore(initialState);
const member = { const member = {
pk: 1, pk: 1,
...@@ -25,8 +21,8 @@ describe('MemberView component', () => { ...@@ -25,8 +21,8 @@ describe('MemberView component', () => {
it('renders correctly', () => { it('renders correctly', () => {
const tree = renderer const tree = renderer
.create(<MemberView store={store} member={member} size={20} />) .create(<MemberView store={initialState} member={member} size={20} />)
.toJSON(); .toJSON();
expect(tree).toMatchSnapshot(); expect(tree).toMatchSnapshot();
}); });
}); });
\ No newline at end of file
...@@ -28,6 +28,7 @@ exports[`MemberView component renders correctly 1`] = ` ...@@ -28,6 +28,7 @@ exports[`MemberView component renders correctly 1`] = `
} }
> >
<View <View
accessibilityIgnoresInvertColors={true}
style={ style={
Object { Object {
"flex": 1, "flex": 1,
...@@ -64,7 +65,19 @@ exports[`MemberView component renders correctly 1`] = ` ...@@ -64,7 +65,19 @@ exports[`MemberView component renders correctly 1`] = `
4278190080, 4278190080,
] ]
} }
endPoint={
Object {
"x": 0.5,
"y": 1,
}
}
locations={null} locations={null}
startPoint={
Object {
"x": 0.5,
"y": 0,
}
}
style={ style={
Object { Object {
"bottom": 0, "bottom": 0,
......
...@@ -26,6 +26,7 @@ exports[`Sidebar component renders correctly 1`] = ` ...@@ -26,6 +26,7 @@ exports[`Sidebar component renders correctly 1`] = `
} }
> >
<View <View
accessibilityIgnoresInvertColors={true}
style={ style={
Object { Object {
"flexDirection": "column", "flexDirection": "column",
...@@ -68,7 +69,19 @@ exports[`Sidebar component renders correctly 1`] = ` ...@@ -68,7 +69,19 @@ exports[`Sidebar component renders correctly 1`] = `
4278190080, 4278190080,
] ]
} }
endPoint={
Object {
"x": 0.5,
"y": 1,
}
}
locations={null} locations={null}
startPoint={
Object {
"x": 0.5,
"y": 0,
}
}
style={ style={
Object { Object {
"bottom": 0, "bottom": 0,
...@@ -161,7 +174,6 @@ exports[`Sidebar component renders correctly 1`] = ` ...@@ -161,7 +174,6 @@ exports[`Sidebar component renders correctly 1`] = `
> >
<Text <Text
allowFontScaling={false} allowFontScaling={false}
onPress={[Function]}
style={ style={
Array [ Array [
Object { Object {
...@@ -183,6 +195,7 @@ exports[`Sidebar component renders correctly 1`] = ` ...@@ -183,6 +195,7 @@ exports[`Sidebar component renders correctly 1`] = `
"fontStyle": "normal", "fontStyle": "normal",
"fontWeight": "normal", "fontWeight": "normal",
}, },
Object {},
] ]
} }
> >
...@@ -252,7 +265,6 @@ exports[`Sidebar component renders correctly 1`] = ` ...@@ -252,7 +265,6 @@ exports[`Sidebar component renders correctly 1`] = `
> >
<Text <Text
allowFontScaling={false} allowFontScaling={false}
onPress={[Function]}
style={ style={
Array [ Array [
Object { Object {
...@@ -274,6 +286,7 @@ exports[`Sidebar component renders correctly 1`] = ` ...@@ -274,6 +286,7 @@ exports[`Sidebar component renders correctly 1`] = `
"fontStyle": "normal", "fontStyle": "normal",
"fontWeight": "normal", "fontWeight": "normal",
}, },
Object {},
] ]
} }
> >
...@@ -343,7 +356,6 @@ exports[`Sidebar component renders correctly 1`] = ` ...@@ -343,7 +356,6 @@ exports[`Sidebar component renders correctly 1`] = `
> >
<Text <Text
allowFontScaling={false} allowFontScaling={false}
onPress={[Function]}
style={ style={
Array [ Array [
Object { Object {
...@@ -365,6 +377,7 @@ exports[`Sidebar component renders correctly 1`] = ` ...@@ -365,6 +377,7 @@ exports[`Sidebar component renders correctly 1`] = `
"fontStyle": "normal", "fontStyle": "normal",
"fontWeight": "normal", "fontWeight": "normal",
}, },
Object {},
] ]
} }
> >
...@@ -434,7 +447,6 @@ exports[`Sidebar component renders correctly 1`] = ` ...@@ -434,7 +447,6 @@ exports[`Sidebar component renders correctly 1`] = `
> >
<Text <Text
allowFontScaling={false} allowFontScaling={false}
onPress={[Function]}
style={ style={
Array [ Array [
Object { Object {
...@@ -456,6 +468,7 @@ exports[`Sidebar component renders correctly 1`] = ` ...@@ -456,6 +468,7 @@ exports[`Sidebar component renders correctly 1`] = `
"fontStyle": "normal", "fontStyle": "normal",
"fontWeight": "normal", "fontWeight": "normal",
}, },
Object {},
] ]
} }
> >
...@@ -528,7 +541,6 @@ exports[`Sidebar component renders correctly 1`] = ` ...@@ -528,7 +541,6 @@ exports[`Sidebar component renders correctly 1`] = `
> >
<Text <Text
allowFontScaling={false} allowFontScaling={false}
onPress={[Function]}
style={ style={
Array [ Array [
Object { Object {
...@@ -550,6 +562,7 @@ exports[`Sidebar component renders correctly 1`] = ` ...@@ -550,6 +562,7 @@ exports[`Sidebar component renders correctly 1`] = `
"fontStyle": "normal", "fontStyle": "normal",
"fontWeight": "normal", "fontWeight": "normal",
}, },
Object {},
] ]
} }
> >
......
import React from 'react'; import React from 'react';
import { Platform } from 'react-native';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
import configureStore from 'redux-mock-store';
import StandardHeader from '../../../../app/ui/components/standardHeader/StandardHeader'; import StandardHeader from '../../../../app/ui/components/standardHeader/StandardHeader';
import reducer from '../../../../app/reducers';
import { Platform } from 'react-native';
jest.mock('react-navigation', () => ({ jest.mock('react-navigation', () => ({
withNavigation: component => component, withNavigation: component => component,
...@@ -14,7 +12,6 @@ const mockNavigation = { ...@@ -14,7 +12,6 @@ const mockNavigation = {
}; };
describe('StandardHeader component', () => { describe('StandardHeader component', () => {
const mockStore = configureStore(reducer);
const initialState = { const initialState = {
navigation: { navigation: {
currentScene: 'home', currentScene: 'home',
...@@ -28,12 +25,11 @@ describe('StandardHeader component', () => { ...@@ -28,12 +25,11 @@ describe('StandardHeader component', () => {
token: 'token123', token: 'token123',
}, },
}; };
const store = mockStore(initialState);
it('renders correctly on iOS', () => { it('renders correctly on iOS', () => {
Platform.OS = 'ios'; Platform.OS = 'ios';
const tree = renderer const tree = renderer
.create(<StandardHeader store={store} navigation={mockNavigation} />) .create(<StandardHeader store={initialState} navigation={mockNavigation} />)
.toJSON(); .toJSON();
expect(tree).toMatchSnapshot(); expect(tree).toMatchSnapshot();
}); });
...@@ -41,7 +37,7 @@ describe('StandardHeader component', () => { ...@@ -41,7 +37,7 @@ describe('StandardHeader component', () => {
it('renders correctly on Android', () => { it('renders correctly on Android', () => {
Platform.OS = 'android'; Platform.OS = 'android';
const tree = renderer const tree = renderer
.create(<StandardHeader store={store} navigation={mockNavigation} />) .create(<StandardHeader store={initialState} navigation={mockNavigation} />)
.toJSON(); .toJSON();
expect(tree).toMatchSnapshot(); expect(tree).toMatchSnapshot();
}); });
......
...@@ -59,6 +59,7 @@ exports[`StandardHeader component renders correctly on Android 1`] = ` ...@@ -59,6 +59,7 @@ exports[`StandardHeader component renders correctly on Android 1`] = `
"fontStyle": "normal", "fontStyle": "normal",
"fontWeight": "normal", "fontWeight": "normal",
}, },
Object {},
] ]
} }
> >
...@@ -153,6 +154,7 @@ exports[`StandardHeader component renders correctly on iOS 1`] = ` ...@@ -153,6 +154,7 @@ exports[`StandardHeader component renders correctly on iOS 1`] = `
"fontStyle": "normal", "fontStyle": "normal",
"fontWeight": "normal", "fontWeight": "normal",
}, },
Object {},
] ]
} }
> >
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:launchMode="singleTop"> android:launchMode="singleTop"
android:usesCleartextTraffic="true">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:label="@string/app_name" android:label="@string/app_name"
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
buildscript { buildscript {
repositories { repositories {
google() google()
mavenCentral()
jcenter() jcenter()
} }
dependencies { dependencies {
...@@ -16,20 +17,21 @@ buildscript { ...@@ -16,20 +17,21 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
google()
mavenLocal()
jcenter()
maven { maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm // 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"
} }
google()
mavenCentral()
mavenLocal()
jcenter()
} }
} }
ext { ext {
buildToolsVersion = "27.0.3" buildToolsVersion = "28.0.3"
minSdkVersion = 16 minSdkVersion = 16
compileSdkVersion = 27 compileSdkVersion = 28
targetSdkVersion = 27 targetSdkVersion = 28
supportLibVersion = "27.1.1" supportLibVersion = "28.0.0"
} }
module.exports = (api) => {
api.cache(false);
return {
presets: [
'module:react-native-dotenv',
'module:metro-react-native-babel-preset',
],
plugins: [
'@babel/plugin-transform-flow-strip-types',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-regenerator',
'@babel/plugin-transform-runtime',
],
};
};
/* eslint-disable global-require,import/no-extraneous-dependencies */
/** /**
* Copyright (c) 2015-present, Facebook, Inc. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
...@@ -11,8 +10,9 @@ ...@@ -11,8 +10,9 @@
/* eslint-env node */ /* eslint-env node */
'use strict';
const { transformSync: babelTransformSync } = require('@babel/core'); const {transformSync: babelTransformSync} = require('@babel/core');
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error /* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and * found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */ * run Flow. */
...@@ -23,41 +23,41 @@ const babelRegisterOnly = require('metro-babel-register'); ...@@ -23,41 +23,41 @@ const babelRegisterOnly = require('metro-babel-register');
const createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction'); const createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction');
const generate = require('@babel/generator').default; const generate = require('@babel/generator').default;
const nodeFiles = RegExp( const nodeFiles = new RegExp(
[ [
'/local-cli/', '/metro(?:-[^/]*)?/', // metro, metro-core, metro-source-map, metro-etc.
'/metro(?:-[^/]*)?/', // metro, metro-core, metro-source-map, metro-etc
].join('|'), ].join('|'),
); );
const nodeOptions = babelRegisterOnly.config([nodeFiles]); const nodeOptions = babelRegisterOnly.config([nodeFiles]);
babelRegisterOnly([]); babelRegisterOnly([]);
/* $FlowFixMe(site=react_native_oss) */ const transformer = require('metro-react-native-babel-transformer');
const transformer = require('metro/src/reactNativeTransformer');
module.exports = { module.exports = {
process(src /* : string */, file /* : string */) { process(src /*: string */, file /*: string */) {
if (nodeFiles.test(file)) { if (nodeFiles.test(file)) {
// node specific transforms only // node specific transforms only
return babelTransformSync( return babelTransformSync(src, {
src, filename: file,
Object.assign( sourceType: 'script',
{ filename: file }, ...nodeOptions,
{ sourceType: 'script', ...nodeOptions, ast: false }, ast: false,
), }).code;
).code;
} }
const { ast } = transformer.transform({ const {ast} = transformer.transform({
filename: file, filename: file,
localPath: file,
options: { options: {
ast: true, // needed for open source (?) https://github.com/facebook/react-native/commit/f8d6b97140cffe8d18b2558f94570c8d1b410d5c#r28647044 ast: true, // needed for open source (?) https://github.com/facebook/react-native/commit/f8d6b97140cffe8d18b2558f94570c8d1b410d5c#r28647044
dev: true, dev: true,
inlineRequires: true, enableBabelRuntime: false,
experimentalImportSupport: false,
hot: false,
inlineRequires: false,
minify: false,
platform: '', platform: '',
projectRoot: '', projectRoot: '',
publicPath: '/assets',
retainLines: true, retainLines: true,
sourceType: 'unambiguous', // b7 required. detects module vs script mode sourceType: 'unambiguous', // b7 required. detects module vs script mode
}, },
...@@ -70,7 +70,7 @@ module.exports = { ...@@ -70,7 +70,7 @@ module.exports = {
[ [
require('@babel/plugin-proposal-class-properties'), require('@babel/plugin-proposal-class-properties'),
// use `this.foo = bar` instead of `this.defineProperty('foo', ...)` // use `this.foo = bar` instead of `this.defineProperty('foo', ...)`
{ loose: true }, {loose: true},
], ],
[require('@babel/plugin-transform-computed-properties')], [require('@babel/plugin-transform-computed-properties')],
[require('@babel/plugin-transform-destructuring')], [require('@babel/plugin-transform-destructuring')],
...@@ -84,7 +84,7 @@ module.exports = { ...@@ -84,7 +84,7 @@ module.exports = {
[require('@babel/plugin-transform-unicode-regex')], [require('@babel/plugin-transform-unicode-regex')],
[ [
require('@babel/plugin-transform-modules-commonjs'), require('@babel/plugin-transform-modules-commonjs'),
{ strict: false, allowTopLevelThis: true }, {strict: false, allowTopLevelThis: true},
], ],
[require('@babel/plugin-transform-classes')], [require('@babel/plugin-transform-classes')],
[require('@babel/plugin-transform-arrow-functions')], [require('@babel/plugin-transform-arrow-functions')],
...@@ -92,11 +92,11 @@ module.exports = { ...@@ -92,11 +92,11 @@ module.exports = {
[require('@babel/plugin-proposal-object-rest-spread')], [require('@babel/plugin-proposal-object-rest-spread')],