-
Notifications
You must be signed in to change notification settings - Fork 17
/
index.js
26 lines (16 loc) · 674 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import React, { Component } from 'react';
import {
requireNativeComponent,
NativeModules,
NativeEventEmitter
} from 'react-native';
const { RNAirplay } = NativeModules;
// Listen to emitted events
const airPlayEmitter = new NativeEventEmitter(RNAirplay);
// Register Events
const isAvailable = airPlayEmitter.addListener('airplayAvailable', (devices) => devices.available)
const isConnected = airPlayEmitter.addListener('airplayConnected', (devices) => devices.connected)
// Export methods and button component
export const AirPlay = RNAirplay;
export const AirPlayListener = airPlayEmitter;
export const AirPlayButton = requireNativeComponent('RNAirplay');