react-native-airplay-module 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -8
- package/ios/AirplayModule.h +0 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +13 -16
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# react-native-airplay-module
|
|
2
2
|
|
|
3
|
-
React Native
|
|
3
|
+
React Native AirPlay Module
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -8,14 +8,31 @@ React Native Airplay module
|
|
|
8
8
|
npm install react-native-airplay-module
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
```sh
|
|
12
|
+
yarn add react-native-airplay-module
|
|
13
|
+
```
|
|
14
|
+
|
|
11
15
|
## Usage
|
|
12
16
|
|
|
13
17
|
```js
|
|
14
|
-
import
|
|
18
|
+
import AirPlay from 'react-native-airplay-module'
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
AirPlay.startScan()
|
|
15
22
|
|
|
16
|
-
|
|
23
|
+
AirPlay.AirPlayListener.addListener('deviceConnected', ({ devices }) => {
|
|
24
|
+
console.log(devices)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
return () => {
|
|
28
|
+
AirPlay.disconnect()
|
|
29
|
+
}
|
|
30
|
+
}, [])
|
|
31
|
+
|
|
32
|
+
const openMenu = () => {
|
|
33
|
+
AirPlay.openMenu()
|
|
34
|
+
}
|
|
17
35
|
|
|
18
|
-
const result = await multiply(3, 7);
|
|
19
36
|
```
|
|
20
37
|
|
|
21
38
|
## Contributing
|
|
@@ -25,7 +42,3 @@ See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the
|
|
|
25
42
|
## License
|
|
26
43
|
|
|
27
44
|
MIT
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
package/ios/AirplayModule.h
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
#import <React/RCTEventEmitter.h>
|
|
2
|
-
|
|
3
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
|
-
#import "RNAirplayModuleSpec.h"
|
|
5
|
-
|
|
6
|
-
@interface AirplayModule : RCTEventEmitter <NativeAirplayModuleSpec>
|
|
7
|
-
#else
|
|
8
2
|
#import <React/RCTBridgeModule.h>
|
|
9
3
|
|
|
10
4
|
@interface AirplayModule : RCTEventEmitter <RCTBridgeModule>
|
|
11
|
-
#endif
|
|
12
5
|
|
|
13
6
|
@end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","AirplayModule","NativeModules","AirPlayListener","NativeEventEmitter","startScan","Platform","OS","disconnect","openMenu","_default","exports","default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GAAGC,0BAAa,CAACD,aAAa;AAEjD,MAAME,eAAe,GAAG,IAAIC,+BAAkB,CAACH,aAAa,CAAC;AAE7D,MAAMI,SAAS,GAAG,SAAAA,CAAA,EAAY;EAC5B,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAAI,CAACN,aAAa,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","AirplayModule","NativeModules","AirPlayListener","NativeEventEmitter","startScan","Platform","OS","disconnect","openMenu","_default","exports","default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GAAGC,0BAAa,CAACD,aAAa;AAEjD,MAAME,eAAe,GAAG,IAAIC,+BAAkB,CAACH,aAAa,CAAC;AAE7D,MAAMI,SAAS,GAAG,SAAAA,CAAA,EAAY;EAC5B,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAAI,CAACN,aAAa,EAAE;EAC7C,OAAOA,aAAa,CAACI,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,MAAMG,UAAU,GAAG,SAAAA,CAAA,EAAY;EAC7B,IAAIF,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAAI,CAACN,aAAa,EAAE;EAC7C,OAAOA,aAAa,CAACO,UAAU,CAAC,CAAC;AACnC,CAAC;AAED,MAAMC,QAAQ,GAAG,SAAAA,CAAA,EAAY;EAC3B,IAAIH,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAAI,CAACN,aAAa,EAAE;EAC7C,OAAOA,aAAa,CAACQ,QAAQ,CAAC,CAAC;AACjC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa;EACbT,eAAe;EACfE,SAAS;EACTG,UAAU;EACVC;AACF,CAAC","ignoreList":[]}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","AirplayModule","AirPlayListener","startScan","OS","disconnect","openMenu"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAE1E,MAAMC,aAAa,GAAGH,aAAa,CAACG,aAAa;AAEjD,MAAMC,eAAe,GAAG,IAAIH,kBAAkB,CAACE,aAAa,CAAC;AAE7D,MAAME,SAAS,GAAG,SAAAA,CAAA,EAAY;EAC5B,IAAIH,QAAQ,CAACI,EAAE,KAAK,KAAK,IAAI,CAACH,aAAa,
|
|
1
|
+
{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","AirplayModule","AirPlayListener","startScan","OS","disconnect","openMenu"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAE1E,MAAMC,aAAa,GAAGH,aAAa,CAACG,aAAa;AAEjD,MAAMC,eAAe,GAAG,IAAIH,kBAAkB,CAACE,aAAa,CAAC;AAE7D,MAAME,SAAS,GAAG,SAAAA,CAAA,EAAY;EAC5B,IAAIH,QAAQ,CAACI,EAAE,KAAK,KAAK,IAAI,CAACH,aAAa,EAAE;EAC7C,OAAOA,aAAa,CAACE,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,MAAME,UAAU,GAAG,SAAAA,CAAA,EAAY;EAC7B,IAAIL,QAAQ,CAACI,EAAE,KAAK,KAAK,IAAI,CAACH,aAAa,EAAE;EAC7C,OAAOA,aAAa,CAACI,UAAU,CAAC,CAAC;AACnC,CAAC;AAED,MAAMC,QAAQ,GAAG,SAAAA,CAAA,EAAY;EAC3B,IAAIN,QAAQ,CAACI,EAAE,KAAK,KAAK,IAAI,CAACH,aAAa,EAAE;EAC7C,OAAOA,aAAa,CAACK,QAAQ,CAAC,CAAC;AACjC,CAAC;AAED,eAAe;EACbJ,eAAe;EACfC,SAAS;EACTE,UAAU;EACVC;AACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,kBAAkB,EAAY,MAAM,cAAc,CAAC;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,kBAAkB,EAAY,MAAM,cAAc,CAAC;;;;;;;AAqB3E,wBAKE"}
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
|
|
2
2
|
|
|
3
|
-
const AirplayModule = NativeModules.AirplayModule
|
|
3
|
+
const AirplayModule = NativeModules.AirplayModule;
|
|
4
4
|
|
|
5
|
-
const AirPlayListener = new NativeEventEmitter(AirplayModule)
|
|
5
|
+
const AirPlayListener = new NativeEventEmitter(AirplayModule);
|
|
6
6
|
|
|
7
7
|
const startScan = function () {
|
|
8
|
-
if (Platform.OS !== 'ios' || !AirplayModule)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
8
|
+
if (Platform.OS !== 'ios' || !AirplayModule) return;
|
|
9
|
+
return AirplayModule.startScan();
|
|
10
|
+
};
|
|
12
11
|
|
|
13
12
|
const disconnect = function () {
|
|
14
|
-
if (Platform.OS !== 'ios' || !AirplayModule)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
13
|
+
if (Platform.OS !== 'ios' || !AirplayModule) return;
|
|
14
|
+
return AirplayModule.disconnect();
|
|
15
|
+
};
|
|
18
16
|
|
|
19
17
|
const openMenu = function () {
|
|
20
|
-
if (Platform.OS !== 'ios' || !AirplayModule)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
18
|
+
if (Platform.OS !== 'ios' || !AirplayModule) return;
|
|
19
|
+
return AirplayModule.openMenu();
|
|
20
|
+
};
|
|
24
21
|
|
|
25
22
|
export default {
|
|
26
23
|
AirPlayListener,
|
|
27
24
|
startScan,
|
|
28
25
|
disconnect,
|
|
29
|
-
openMenu
|
|
30
|
-
}
|
|
26
|
+
openMenu,
|
|
27
|
+
};
|