Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Commit

Permalink
refactor: use typescript (#197)
Browse files Browse the repository at this point in the history
* refactor: use typescript

* build: skip lib check

it make TS to raise errors
  • Loading branch information
tanguyantoine committed Nov 23, 2018
1 parent 80df640 commit fbb7144
Show file tree
Hide file tree
Showing 12 changed files with 287 additions and 278 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -5,3 +5,4 @@ android/build
.vscode/
.DS_Store
node_modules/
lib/
28 changes: 0 additions & 28 deletions constants.android.js

This file was deleted.

28 changes: 0 additions & 28 deletions constants.ios.js

This file was deleted.

123 changes: 0 additions & 123 deletions index.d.ts

This file was deleted.

98 changes: 0 additions & 98 deletions index.js

This file was deleted.

17 changes: 16 additions & 1 deletion package.json
Expand Up @@ -2,6 +2,13 @@
"name": "react-native-music-control",
"version": "0.7.3",
"description": "Add information on lockscreen and control playing music",
"main": "lib/index.js",
"types": "./lib/index.d.ts",
"files": [
"ios/",
"android/",
"lib/"
],
"keywords": [
"react",
"react-native",
Expand All @@ -18,5 +25,13 @@
"peerDependencies": {
"react-native": ">=0.40.0"
},
"rnpm": {}
"scripts": {
"prepack": "tsc -p tsconfig.json",
"start": "tsc -p tsconfig.json -w"
},
"rnpm": {},
"devDependencies": {
"@types/react-native": "^0.57.11",
"typescript": "^3.1.6"
}
}
28 changes: 28 additions & 0 deletions src/constants.android.ts
@@ -0,0 +1,28 @@
import { NativeModules } from 'react-native'
const NativeMusicControl = NativeModules.MusicControlManager

const STATE_PLAYING = NativeMusicControl.STATE_PLAYING
const STATE_PAUSED = NativeMusicControl.STATE_PAUSED
const STATE_ERROR = NativeMusicControl.STATE_PAUSED
const STATE_STOPPED = NativeMusicControl.STATE_PAUSED
const STATE_BUFFERING = NativeMusicControl.STATE_PAUSED
const RATING_HEART = 0
const RATING_THUMBS_UP_DOWN = 0
const RATING_3_STARS = 0
const RATING_4_STARS = 0
const RATING_5_STARS = 0
const RATING_PERCENTAGE = 0

export default {
STATE_PLAYING,
STATE_PAUSED,
STATE_ERROR,
STATE_STOPPED,
STATE_BUFFERING,
RATING_HEART,
RATING_THUMBS_UP_DOWN,
RATING_3_STARS,
RATING_4_STARS,
RATING_5_STARS,
RATING_PERCENTAGE
}
28 changes: 28 additions & 0 deletions src/constants.ios.ts
@@ -0,0 +1,28 @@
import { NativeModules } from 'react-native'
const NativeMusicControl = NativeModules.MusicControlManager

const STATE_PLAYING = NativeMusicControl.STATE_PLAYING
const STATE_PAUSED = NativeMusicControl.STATE_PAUSED
const STATE_ERROR = NativeMusicControl.STATE_ERROR
const STATE_STOPPED = NativeMusicControl.STATE_STOPPED
const STATE_BUFFERING = NativeMusicControl.STATE_BUFFERING
const RATING_HEART = NativeMusicControl.RATING_HEART
const RATING_THUMBS_UP_DOWN = NativeMusicControl.RATING_THUMBS_UP_DOWN
const RATING_3_STARS = NativeMusicControl.RATING_3_STARS
const RATING_4_STARS = NativeMusicControl.RATING_4_STARS
const RATING_5_STARS = NativeMusicControl.RATING_5_STARS
const RATING_PERCENTAGE = NativeMusicControl.RATING_PERCENTAGE

export default {
STATE_PLAYING,
STATE_PAUSED,
STATE_ERROR,
STATE_STOPPED,
STATE_BUFFERING,
RATING_HEART,
RATING_THUMBS_UP_DOWN,
RATING_3_STARS,
RATING_4_STARS,
RATING_5_STARS,
RATING_PERCENTAGE
}

0 comments on commit fbb7144

Please sign in to comment.