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:
GRADLE_USER_HOME: $CI_PROJECT_DIR/.gradle
......@@ -10,6 +10,7 @@ stages:
eslint:
stage: validate
before_script:
- apk update && apk add git
- yarn install
script:
- yarn lint:ci
......@@ -17,6 +18,7 @@ eslint:
jest:
stage: validate
before_script:
- apk update && apk add git
- yarn install
script:
- yarn jest
......@@ -47,9 +49,11 @@ build android:
- $CI_PROJECT_DIR/.gradle/wrapper/
- $CI_PROJECT_DIR/.gradle/caches/
before_script:
- sysctl fs.inotify.max_user_watches=524288
- set +o pipefail
- yes | /opt/android-sdk-linux/tools/bin/sdkmanager --licenses
- set -o pipefail
- apk update && apk add git
- yarn install
script:
- echo $SENTRY_PROPS | base64 -d > ./android/sentry.properties
......@@ -60,4 +64,4 @@ build android:
paths:
- $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.apk
\ No newline at end of file
- $CI_PROJECT_DIR/android/app/build/outputs/apk/release/app-release.apk
import React from 'react';
import renderer from 'react-test-renderer';
import configureStore from 'redux-mock-store'
import MemberView from '../../../../app/ui/components/memberView/MemberView';
import reducer from '../../../../app/reducers/index';
jest.mock('react-navigation', () => ({
withNavigation: component => component,
}));
describe('MemberView component', () => {
const mockStore = configureStore(reducer);
const initialState = {
session: {
token: 'token123',
},
};
const store = mockStore(initialState);
const member = {
pk: 1,
......@@ -25,8 +21,8 @@ describe('MemberView component', () => {
it('renders correctly', () => {
const tree = renderer
.create(<MemberView store={store} member={member} size={20} />)
.create(<MemberView store={initialState} member={member} size={20} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
});
\ No newline at end of file
});
......@@ -28,6 +28,7 @@ exports[`MemberView component renders correctly 1`] = `
}
>
<View
accessibilityIgnoresInvertColors={true}
style={
Object {
"flex": 1,
......@@ -64,7 +65,19 @@ exports[`MemberView component renders correctly 1`] = `
4278190080,
]
}
endPoint={
Object {
"x": 0.5,
"y": 1,
}
}
locations={null}
startPoint={
Object {
"x": 0.5,
"y": 0,
}
}
style={
Object {
"bottom": 0,
......
......@@ -26,6 +26,7 @@ exports[`Sidebar component renders correctly 1`] = `
}
>
<View
accessibilityIgnoresInvertColors={true}
style={
Object {
"flexDirection": "column",
......@@ -68,7 +69,19 @@ exports[`Sidebar component renders correctly 1`] = `
4278190080,
]
}
endPoint={
Object {
"x": 0.5,
"y": 1,
}
}
locations={null}
startPoint={
Object {
"x": 0.5,
"y": 0,
}
}
style={
Object {
"bottom": 0,
......@@ -161,7 +174,6 @@ exports[`Sidebar component renders correctly 1`] = `
>
<Text
allowFontScaling={false}
onPress={[Function]}
style={
Array [
Object {
......@@ -183,6 +195,7 @@ exports[`Sidebar component renders correctly 1`] = `
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
}
>
......@@ -252,7 +265,6 @@ exports[`Sidebar component renders correctly 1`] = `
>
<Text
allowFontScaling={false}
onPress={[Function]}
style={
Array [
Object {
......@@ -274,6 +286,7 @@ exports[`Sidebar component renders correctly 1`] = `
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
}
>
......@@ -343,7 +356,6 @@ exports[`Sidebar component renders correctly 1`] = `
>
<Text
allowFontScaling={false}
onPress={[Function]}
style={
Array [
Object {
......@@ -365,6 +377,7 @@ exports[`Sidebar component renders correctly 1`] = `
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
}
>
......@@ -434,7 +447,6 @@ exports[`Sidebar component renders correctly 1`] = `
>
<Text
allowFontScaling={false}
onPress={[Function]}
style={
Array [
Object {
......@@ -456,6 +468,7 @@ exports[`Sidebar component renders correctly 1`] = `
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
}
>
......@@ -528,7 +541,6 @@ exports[`Sidebar component renders correctly 1`] = `
>
<Text
allowFontScaling={false}
onPress={[Function]}
style={
Array [
Object {
......@@ -550,6 +562,7 @@ exports[`Sidebar component renders correctly 1`] = `
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
}
>
......
import React from 'react';
import { Platform } from 'react-native';
import renderer from 'react-test-renderer';
import configureStore from 'redux-mock-store';
import StandardHeader from '../../../../app/ui/components/standardHeader/StandardHeader';
import reducer from '../../../../app/reducers';
import { Platform } from 'react-native';
jest.mock('react-navigation', () => ({
withNavigation: component => component,
......@@ -14,7 +12,6 @@ const mockNavigation = {
};
describe('StandardHeader component', () => {
const mockStore = configureStore(reducer);
const initialState = {
navigation: {
currentScene: 'home',
......@@ -28,12 +25,11 @@ describe('StandardHeader component', () => {
token: 'token123',
},
};
const store = mockStore(initialState);
it('renders correctly on iOS', () => {
Platform.OS = 'ios';
const tree = renderer
.create(<StandardHeader store={store} navigation={mockNavigation} />)
.create(<StandardHeader store={initialState} navigation={mockNavigation} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
......@@ -41,7 +37,7 @@ describe('StandardHeader component', () => {
it('renders correctly on Android', () => {
Platform.OS = 'android';
const tree = renderer
.create(<StandardHeader store={store} navigation={mockNavigation} />)
.create(<StandardHeader store={initialState} navigation={mockNavigation} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
......
......@@ -59,6 +59,7 @@ exports[`StandardHeader component renders correctly on Android 1`] = `
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
}
>
......@@ -153,6 +154,7 @@ exports[`StandardHeader component renders correctly on iOS 1`] = `
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
}
>
......
......@@ -12,7 +12,8 @@
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme"
android:launchMode="singleTop">
android:launchMode="singleTop"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
......
......@@ -3,6 +3,7 @@
buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
......@@ -16,20 +17,21 @@ buildscript {
allprojects {
repositories {
google()
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
google()
mavenCentral()
mavenLocal()
jcenter()
}
}
ext {
buildToolsVersion = "27.0.3"
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 27
supportLibVersion = "27.1.1"
compileSdkVersion = 28
targetSdkVersion = 28
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
* LICENSE file in the root directory of this source tree.
......@@ -11,8 +10,9 @@
/* 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
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
......@@ -23,41 +23,41 @@ const babelRegisterOnly = require('metro-babel-register');
const createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction');
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('|'),
);
const nodeOptions = babelRegisterOnly.config([nodeFiles]);
babelRegisterOnly([]);
/* $FlowFixMe(site=react_native_oss) */
const transformer = require('metro/src/reactNativeTransformer');
const transformer = require('metro-react-native-babel-transformer');
module.exports = {
process(src /* : string */, file /* : string */) {
process(src /*: string */, file /*: string */) {
if (nodeFiles.test(file)) {
// node specific transforms only
return babelTransformSync(
src,
Object.assign(
{ filename: file },
{ sourceType: 'script', ...nodeOptions, ast: false },
),
).code;
return babelTransformSync(src, {
filename: file,
sourceType: 'script',
...nodeOptions,
ast: false,
}).code;
}
const { ast } = transformer.transform({
const {ast} = transformer.transform({
filename: file,
localPath: file,
options: {
ast: true, // needed for open source (?) https://github.com/facebook/react-native/commit/f8d6b97140cffe8d18b2558f94570c8d1b410d5c#r28647044
dev: true,
inlineRequires: true,
enableBabelRuntime: false,
experimentalImportSupport: false,
hot: false,
inlineRequires: false,
minify: false,
platform: '',
projectRoot: '',
publicPath: '/assets',
retainLines: true,
sourceType: 'unambiguous', // b7 required. detects module vs script mode
},
......@@ -70,7 +70,7 @@ module.exports = {
[
require('@babel/plugin-proposal-class-properties'),
// use `this.foo = bar` instead of `this.defineProperty('foo', ...)`
{ loose: true },
{loose: true},
],
[require('@babel/plugin-transform-computed-properties')],
[require('@babel/plugin-transform-destructuring')],
......@@ -84,7 +84,7 @@ module.exports = {
[require('@babel/plugin-transform-unicode-regex')],
[
require('@babel/plugin-transform-modules-commonjs'),
{ strict: false, allowTopLevelThis: true },
{strict: false, allowTopLevelThis: true},
],
[require('@babel/plugin-transform-classes')],
[require('@babel/plugin-transform-arrow-functions')],
......@@ -92,11 +92,11 @@ module.exports = {
[require('@babel/plugin-proposal-object-rest-spread')],
[
require('@babel/plugin-transform-template-literals'),
{ loose: true }, // dont 'a'.concat('b'), just use 'a'+'b'
{loose: true}, // dont 'a'.concat('b'), just use 'a'+'b'
],
[require('@babel/plugin-transform-exponentiation-operator')],
[require('@babel/plugin-transform-object-assign')],
[require('@babel/plugin-transform-for-of'), { loose: true }],
[require('@babel/plugin-transform-for-of'), {loose: true}],
[require('@babel/plugin-transform-react-display-name')],
[require('@babel/plugin-transform-react-jsx-source')],
// used to hoist jest mocks
......@@ -121,7 +121,7 @@ module.exports = {
getCacheKey: createCacheKeyFunction([
__filename,
require.resolve('metro/src/reactNativeTransformer'),
require.resolve('metro-react-native-babel-transformer'),
require.resolve('@babel/core/package.json'),
]),
};
......@@ -40,7 +40,7 @@
"^.+\\.js$": "<rootDir>/jest/preprocessor.js"
},
"transformIgnorePatterns": [
"node_modules/(?!react-native|react-navigation)/"
"node_modules/(?!react-native|react-navigation|i18next-react-native-language-detector|react-navigation-drawer/)"
],
"moduleNameMapper": {
"react-i18next": "<rootDir>/__mocks__/react-i18next-mock.js"
......@@ -49,43 +49,51 @@
"dependencies": {
"i18next": "^11.4.0",
"i18next-react-native-language-detector": "^1.0.2",
"moment": "^2.22.2",
"prop-types": "^15.6.2",
"react": "16.4.1",
"metro-react-native-babel-preset": "^0.52.0",
"metro-react-native-babel-transformer": "^0.52.0",
"moment": "^2.24.0",
"prop-types": "^15.7.2",
"react": "^16.8.2",
"react-i18next": "^7.9.0",
"react-native": "0.56.0",
"react-native": "0.58.5",
"react-native-cli": "^2.0.1",
"react-native-dotenv": "^0.2.0",
"react-native-drawer": "^2.3.0",
"react-native-firebase": "5.0.0-rc0",
"react-native-linear-gradient": "^2.4.0",
"react-native-locale-detector": "^1.0.1",
"react-native-render-html": "^3.10.0",
"react-native-render-html": "^4.1.1",
"react-native-sentry": "^0.39.0",
"react-native-share": "^1.1.3",
"react-native-snackbar": "^0.4.7",
"react-native-vector-icons": "^4.6.0",
"react-navigation": "^2.9.3",
"react-native-vector-icons": "^6.3.0",
"react-navigation": "^2.18.3",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-saga": "^0.16.0"
},
"devDependencies": {
"@babel/plugin-transform-runtime": "^7.0.0-beta.56",
"@babel/plugin-proposal-class-properties": "^7.3.3",
"@babel/plugin-proposal-optional-chaining": "^7.2.0",
"@babel/plugin-transform-flow-strip-types": "^7.2.3",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.3.1",
"@babel/preset-react": "^7.0.0",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^9.0.0-beta.3",
"babel-jest": "^23.4.2",
"babel-preset-react-native": "5.0.2",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.1.0",
"babel-preset-react-native": "^4.0.1",
"eslint": "^5.2.0",
"eslint-config-airbnb": "^17.0.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.10.0",
"eslint-plugin-react-native": "^3.2.1",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.12.4",
"eslint-plugin-react-native": "^3.6.0",
"i18next-scanner": "^2.6.3",
"jest": "^23.4.2",
"react-native-git-upgrade": "^0.2.7",
"react-test-renderer": "^16.3.0-alpha.1",
"redux-mock-store": "^1.5.1",
"react-test-renderer": "^16.8.2",
"redux-mock-store": "^1.5.3",
"redux-saga-test-plan": "^3.2.0"
}
}
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment