diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 566b63d..9cedf83 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,9 @@ name: build on: push: - branches: [ develop ] + branches: [ master ] pull_request: - branches: [ develop ] + branches: [ master ] jobs: build-and-test: diff --git a/README.md b/README.md index 72fb464..565c877 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,4 @@ [![build](https://github.com/flyerhq/react-native-chat-ui/workflows/build/badge.svg)](https://github.com/flyerhq/react-native-chat-ui/actions?query=workflow%3Abuild) [![Maintainability](https://api.codeclimate.com/v1/badges/cc0aeb07c6674ce204ec/maintainability)](https://codeclimate.com/github/flyerhq/react-native-chat-ui/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/cc0aeb07c6674ce204ec/test_coverage)](https://codeclimate.com/github/flyerhq/react-native-chat-ui/test_coverage) -[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&suffix=%&query=$.typeCoverage.is&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fflyerhq%2Freact-native-chat-ui%2Fdevelop%2Fpackage.json)](https://github.com/plantain-00/type-coverage) +[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&suffix=%&query=$.typeCoverage.is&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fflyerhq%2Freact-native-chat-ui%2Fmaster%2Fpackage.json)](https://github.com/plantain-00/type-coverage) diff --git a/__mocks__/react-native-safe-area-context.ts b/__mocks__/react-native-safe-area-context.ts deleted file mode 100644 index 7d194a6..0000000 --- a/__mocks__/react-native-safe-area-context.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const useSafeAreaInsets = jest.fn(() => ({ - top: 0, - right: 0, - bottom: 0, - left: 0, -})) diff --git a/example/package.json b/example/package.json index 0487a73..b42e0bd 100644 --- a/example/package.json +++ b/example/package.json @@ -27,7 +27,7 @@ "@types/uuid": "^8.0.0", "babel-jest": "^26.0.1", "casual": "^1.6.2", - "eslint": "^7.1.0", + "eslint": "^7.2.0", "eslint-plugin-simple-import-sort": "^5.0.3", "jest": "^26.0.1", "metro-react-native-babel-preset": "^0.59.0", diff --git a/example/yarn.lock b/example/yarn.lock index d1112a0..db0902f 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -1852,6 +1852,11 @@ acorn@^7.1.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.1.tgz#e35668de0b402f359de515c5482a1ab9f89a69bf" integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg== +acorn@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.2.0.tgz#17ea7e40d7c8640ff54a694c889c26f31704effe" + integrity sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ== + ajv@^6.10.0, ajv@^6.10.2: version "6.12.0" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.0.tgz#06d60b96d87b8454a5adaba86e7854da629db4b7" @@ -3173,6 +3178,14 @@ eslint-scope@^5.0.0: esrecurse "^4.1.0" estraverse "^4.1.1" +eslint-scope@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.0.tgz#d0f971dfe59c69e0cada684b23d49dbf82600ce5" + integrity sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + eslint-utils@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.0.0.tgz#7be1cc70f27a72a76cd14aa698bcabed6890e1cd" @@ -3185,10 +3198,15 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== -eslint@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.1.0.tgz#d9a1df25e5b7859b0a3d86bb05f0940ab676a851" - integrity sha512-DfS3b8iHMK5z/YLSme8K5cge168I8j8o1uiVmFCgnnjxZQbCGyraF8bMl7Ju4yfBmCuxD7shOF7eqGkcuIHfsA== +eslint-visitor-keys@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.2.0.tgz#74415ac884874495f78ec2a97349525344c981fa" + integrity sha512-WFb4ihckKil6hu3Dp798xdzSfddwKKU3+nGniKF6HfeW6OLd2OUDEPP7TcHtB5+QXOKg2s6B2DaMPE1Nn/kxKQ== + +eslint@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.2.0.tgz#d41b2e47804b30dbabb093a967fb283d560082e6" + integrity sha512-B3BtEyaDKC5MlfDa2Ha8/D6DsS4fju95zs0hjS3HdGazw+LNayai38A25qMppK37wWGWNYSPOR6oYzlz5MHsRQ== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.10.0" @@ -3196,10 +3214,10 @@ eslint@^7.1.0: cross-spawn "^7.0.2" debug "^4.0.1" doctrine "^3.0.0" - eslint-scope "^5.0.0" + eslint-scope "^5.1.0" eslint-utils "^2.0.0" - eslint-visitor-keys "^1.1.0" - espree "^7.0.0" + eslint-visitor-keys "^1.2.0" + espree "^7.1.0" esquery "^1.2.0" esutils "^2.0.2" file-entry-cache "^5.0.1" @@ -3227,14 +3245,14 @@ eslint@^7.1.0: text-table "^0.2.0" v8-compile-cache "^2.0.3" -espree@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-7.0.0.tgz#8a7a60f218e69f120a842dc24c5a88aa7748a74e" - integrity sha512-/r2XEx5Mw4pgKdyb7GNLQNsu++asx/dltf/CI8RFi9oGHxmQFgvLbc5Op4U6i8Oaj+kdslhJtVlEZeAqH5qOTw== +espree@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-7.1.0.tgz#a9c7f18a752056735bf1ba14cb1b70adc3a5ce1c" + integrity sha512-dcorZSyfmm4WTuTnE5Y7MEN1DyoPYy1ZR783QW1FJoenn7RailyWFsq/UL6ZAAA7uXurN9FIpYyUs3OfiIW+Qw== dependencies: - acorn "^7.1.1" + acorn "^7.2.0" acorn-jsx "^5.2.0" - eslint-visitor-keys "^1.1.0" + eslint-visitor-keys "^1.2.0" esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" diff --git a/jest/setup.ts b/jest/setup.ts index ea8364a..f1875d9 100644 --- a/jest/setup.ts +++ b/jest/setup.ts @@ -1,13 +1,4 @@ -import { Dimensions, LayoutAnimation } from 'react-native' import * as utils from '../src/utils' -jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter') - jest.spyOn(Date, 'now').mockReturnValue(0) -jest - .spyOn(Dimensions, 'get') - .mockImplementation( - jest.fn(() => ({ width: 414, height: 896, scale: 2, fontScale: 1 })) - ) -jest.spyOn(LayoutAnimation, 'configureNext').mockImplementation() jest.spyOn(utils, 'uuidv4').mockReturnValue('uuidv4') diff --git a/package.json b/package.json index 1ea7100..87547a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@flyerhq/react-native-chat-ui", - "version": "0.1.5", + "version": "0.1.7", "description": "React Native Chat UI", "homepage": "https://github.com/flyerhq/react-native-chat-ui#readme", "main": "lib/index.js", @@ -21,25 +21,25 @@ "type-coverage": "type-coverage --is 100 --strict --ignore-catch --cache" }, "dependencies": { - "@flyerhq/react-native-keyboard-accessory-view": "^1.0.8" + "@flyerhq/react-native-keyboard-accessory-view": "^1.1.0" }, "devDependencies": { "@babel/core": "^7.10.2", "@babel/runtime": "^7.10.2", "@react-native-community/eslint-config": "^1.1.0", - "@testing-library/react-hooks": "^3.3.0", "@types/jest": "^25.2.3", "@types/react-native": "^0.62.13", "@types/react-test-renderer": "^16.9.2", "babel-jest": "^26.0.1", "copyfiles": "^2.3.0", - "eslint": "^7.1.0", + "eslint": "^7.2.0", "eslint-plugin-jest": "^23.13.2", "eslint-plugin-simple-import-sort": "^5.0.3", "jest": "^26.0.1", "metro-react-native-babel-preset": "^0.59.0", "react": "^16.13.1", "react-native": "^0.62.2", + "react-native-safe-area-context": "^3.0.2", "react-native-testing-library": "^2.0.1", "react-test-renderer": "^16.13.1", "type-coverage": "^2.7.1", diff --git a/tsconfig.json b/tsconfig.json index 2897ef8..f81e08d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,11 +9,10 @@ "noUnusedLocals": true, "noUnusedParameters": true, "outDir": "./lib", - "removeComments": true, "sourceMap": true, "strict": true, "target": "ESNext" }, "include": ["src"], - "exclude": ["node_modules", "src/fixtures", "**/__tests__/*"] + "exclude": ["node_modules", "**/__tests__/*"] } diff --git a/yarn.lock b/yarn.lock index 2e3df7f..b2e19c8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1030,13 +1030,6 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.5.4": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.8.3.tgz#0811944f73a6c926bb2ad35e918dcc1bfab279f1" - integrity sha512-fVHx1rzEmwB130VTkLnxR+HmxcTjGzH12LYQcFFoBwakMd3aOMD4OsRN7tGG/UOYE2ektgFrS8uACAoRk1CY0w== - dependencies: - regenerator-runtime "^0.13.2" - "@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.4.4", "@babel/template@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6" @@ -1209,10 +1202,10 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@flyerhq/react-native-keyboard-accessory-view@^1.0.8": - version "1.0.8" - resolved "https://registry.yarnpkg.com/@flyerhq/react-native-keyboard-accessory-view/-/react-native-keyboard-accessory-view-1.0.8.tgz#682fc30a46fd75d835b38bf8b8cf081b36a5842a" - integrity sha512-BLosTaw1U+5HTX31yQDWthOtCIOdJAbRDUm0RQVLFcwqM46gw0JpWlUgHdeE0Do42/i36gcL7tofNEVVFUP2Dw== +"@flyerhq/react-native-keyboard-accessory-view@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@flyerhq/react-native-keyboard-accessory-view/-/react-native-keyboard-accessory-view-1.1.0.tgz#dfe5b36eb1f51b8e22aa3cf7ae11eaf7e3b944c3" + integrity sha512-O59twf2uVQ8CFP5X5prFjitp9kSLt+VYZXdKY54wkaJrdvybKfQRGEoDMCxTsKhxGGNNMpMLyZ3b1f4ONejYbQ== "@hapi/address@2.x.x": version "2.1.2" @@ -1614,14 +1607,6 @@ dependencies: "@sinonjs/commons" "^1.7.0" -"@testing-library/react-hooks@^3.3.0": - version "3.3.0" - resolved "https://registry.yarnpkg.com/@testing-library/react-hooks/-/react-hooks-3.3.0.tgz#dc217bfce8e7c34a99c811d73d23feef957b7c1d" - integrity sha512-rE9geI1+HJ6jqXkzzJ6abREbeud6bLF8OmF+Vyc7gBoPwZAEVBYjbC1up5nNoVfYBhO5HUwdD4u9mTehAUeiyw== - dependencies: - "@babel/runtime" "^7.5.4" - "@types/testing-library__react-hooks" "^3.0.0" - "@types/babel__core@^7.1.7": version "7.1.7" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.7.tgz#1dacad8840364a57c98d0dd4855c6dd3752c6b89" @@ -1732,7 +1717,7 @@ dependencies: "@types/react" "*" -"@types/react-test-renderer@*", "@types/react-test-renderer@^16.9.2": +"@types/react-test-renderer@^16.9.2": version "16.9.2" resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-16.9.2.tgz#e1c408831e8183e5ad748fdece02214a7c2ab6c5" integrity sha512-4eJr1JFLIAlWhzDkBCkhrOIWOvOxcCAfQh+jiKg7l/nNZcCIL2MHl2dZhogIFKyHzedVWHaVP1Yydq/Ruu4agw== @@ -1752,14 +1737,6 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== -"@types/testing-library__react-hooks@^3.0.0": - version "3.2.0" - resolved "https://registry.yarnpkg.com/@types/testing-library__react-hooks/-/testing-library__react-hooks-3.2.0.tgz#52f3a109bef06080e3b1e3ae7ea1c014ce859897" - integrity sha512-dE8iMTuR5lzB+MqnxlzORlXzXyCL0EKfzH0w/lau20OpkHD37EaWjZDz0iNG8b71iEtxT4XKGmSKAGVEqk46mw== - dependencies: - "@types/react" "*" - "@types/react-test-renderer" "*" - "@types/yargs-parser@*": version "13.1.0" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.1.0.tgz#c563aa192f39350a1d18da36c5a8da382bbd8228" @@ -1898,6 +1875,11 @@ acorn@^7.1.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.1.tgz#e35668de0b402f359de515c5482a1ab9f89a69bf" integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg== +acorn@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.2.0.tgz#17ea7e40d7c8640ff54a694c889c26f31704effe" + integrity sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ== + ajv@^6.10.0, ajv@^6.10.2: version "6.12.0" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.0.tgz#06d60b96d87b8454a5adaba86e7854da629db4b7" @@ -3230,6 +3212,14 @@ eslint-scope@^5.0.0: esrecurse "^4.1.0" estraverse "^4.1.1" +eslint-scope@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.0.tgz#d0f971dfe59c69e0cada684b23d49dbf82600ce5" + integrity sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + eslint-utils@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.0.0.tgz#7be1cc70f27a72a76cd14aa698bcabed6890e1cd" @@ -3242,10 +3232,15 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== -eslint@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.1.0.tgz#d9a1df25e5b7859b0a3d86bb05f0940ab676a851" - integrity sha512-DfS3b8iHMK5z/YLSme8K5cge168I8j8o1uiVmFCgnnjxZQbCGyraF8bMl7Ju4yfBmCuxD7shOF7eqGkcuIHfsA== +eslint-visitor-keys@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.2.0.tgz#74415ac884874495f78ec2a97349525344c981fa" + integrity sha512-WFb4ihckKil6hu3Dp798xdzSfddwKKU3+nGniKF6HfeW6OLd2OUDEPP7TcHtB5+QXOKg2s6B2DaMPE1Nn/kxKQ== + +eslint@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.2.0.tgz#d41b2e47804b30dbabb093a967fb283d560082e6" + integrity sha512-B3BtEyaDKC5MlfDa2Ha8/D6DsS4fju95zs0hjS3HdGazw+LNayai38A25qMppK37wWGWNYSPOR6oYzlz5MHsRQ== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.10.0" @@ -3253,10 +3248,10 @@ eslint@^7.1.0: cross-spawn "^7.0.2" debug "^4.0.1" doctrine "^3.0.0" - eslint-scope "^5.0.0" + eslint-scope "^5.1.0" eslint-utils "^2.0.0" - eslint-visitor-keys "^1.1.0" - espree "^7.0.0" + eslint-visitor-keys "^1.2.0" + espree "^7.1.0" esquery "^1.2.0" esutils "^2.0.2" file-entry-cache "^5.0.1" @@ -3284,14 +3279,14 @@ eslint@^7.1.0: text-table "^0.2.0" v8-compile-cache "^2.0.3" -espree@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-7.0.0.tgz#8a7a60f218e69f120a842dc24c5a88aa7748a74e" - integrity sha512-/r2XEx5Mw4pgKdyb7GNLQNsu++asx/dltf/CI8RFi9oGHxmQFgvLbc5Op4U6i8Oaj+kdslhJtVlEZeAqH5qOTw== +espree@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-7.1.0.tgz#a9c7f18a752056735bf1ba14cb1b70adc3a5ce1c" + integrity sha512-dcorZSyfmm4WTuTnE5Y7MEN1DyoPYy1ZR783QW1FJoenn7RailyWFsq/UL6ZAAA7uXurN9FIpYyUs3OfiIW+Qw== dependencies: - acorn "^7.1.1" + acorn "^7.2.0" acorn-jsx "^5.2.0" - eslint-visitor-keys "^1.1.0" + eslint-visitor-keys "^1.2.0" esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" @@ -6370,6 +6365,11 @@ react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.11.0.tgz#b85dfecd48ad1ce469ff558a882ca8e8313928fa" integrity sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw== +react-native-safe-area-context@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-3.0.2.tgz#95dd7e56bc89bcc4f3f7bb5fada30c98420328b2" + integrity sha512-x3yVMsxwe9GyvIkv0Q5jy2CWYN7VO0/CJTFGG5kSiMo8FFTQJbWtuWGANFqxDzEH5NEV7/SfK+qTgAh931KyUw== + react-native-testing-library@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/react-native-testing-library/-/react-native-testing-library-2.0.1.tgz#ff2aa9fd065f964ddae4e92c3e361b84276d236a"