From e0e12ca7872ec7df02fccf7a578a5210831539c4 Mon Sep 17 00:00:00 2001 From: Quan Pham Date: Mon, 20 Mar 2023 22:59:53 +0700 Subject: [PATCH] Remove non-null argument and update dependencies --- .github/workflows/auto-publish.yml | 6 +++--- .npmrc | 1 + package.json | 20 +++++++++----------- src/index.ts | 6 ++---- 4 files changed, 15 insertions(+), 18 deletions(-) create mode 100644 .npmrc diff --git a/.github/workflows/auto-publish.yml b/.github/workflows/auto-publish.yml index a694e07..9fce401 100644 --- a/.github/workflows/auto-publish.yml +++ b/.github/workflows/auto-publish.yml @@ -14,10 +14,10 @@ jobs: name: Publish to NPM runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: 14 + node-version: 18 - run: npm i -g typescript - run: npm install - uses: JS-DevTools/npm-publish@v1 # https://github.com/JS-DevTools/npm-publish diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..449691b --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +save-exact=true \ No newline at end of file diff --git a/package.json b/package.json index 011dbdb..d5dd95e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-native-shake", - "version": "5.1.1", - "description": "Detect shake event on Android and iOS", + "version": "5.2.0", + "description": "A library to detect shake event on Android and iOS", "homepage": "https://github.com/Doko-Demo-Doa/react-native-shake", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -30,7 +30,7 @@ "url": "https://github.com/Doko-Demo-Doa/react-native-shake.git" }, "scripts": { - "compile": "rm -rf lib && tsc -p .", + "compile": "rimraf lib && tsc -p .", "lint": "eslint . --ext .js,.jsx,.ts,.tsx", "prepare": "npm run compile", "test": "jest" @@ -41,20 +41,18 @@ "@react-native-community/eslint-config": "3.0.1", "@types/jest": "26.0.22", "@types/react-native": "0.64.2", - "@types/react-test-renderer": "17.0.1", "babel-jest": "26.6.3", "eslint": "7.23.0", - "eslint-plugin-simple-import-sort": "7.0.0", - "jest": "26.6.3", + "eslint-plugin-simple-import-sort": "10.0.0", + "jest": "29.5.0", "metro-react-native-babel-preset": "0.65.2", - "react": "17.0.2", - "react-native": "^0.64.0", - "react-test-renderer": "17.0.2", - "typescript": "4.2.3" + "react": "18.2.0", + "rimraf": "4.4.0", + "typescript": "4.9.5" }, "peerDependencies": { "react": "*", - "react-native": "*" + "react-native": "0.71.4" }, "jest": { "preset": "react-native", diff --git a/src/index.ts b/src/index.ts index e987ed3..617034f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ -import { NativeEventEmitter, NativeModules } from 'react-native' +import { NativeEventEmitter } from 'react-native' -const _eventEmitter = new NativeEventEmitter(NativeModules.RNShakeEvent) +const _eventEmitter = new NativeEventEmitter() export default { addListener: (callback: () => void | undefined) => { @@ -12,6 +12,4 @@ export default { }, removeAllListeners: () => _eventEmitter.removeAllListeners('ShakeEvent'), - - removeCurrentListener: () => _eventEmitter.removeCurrentListener(), }