-
Notifications
You must be signed in to change notification settings - Fork 0
/
CastButton.js
54 lines (48 loc) · 1.72 KB
/
CastButton.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// @flow
import React from 'react'
import PropTypes from 'prop-types'
import { requireNativeComponent, NativeModules } from 'react-native';
const { RNGoogleCast: GoogleCast } = NativeModules;
/**
* Button that presents the Cast icon.
*
* By default, upon pressing the button it opens the native Cast dialog.
*
* @see [GCKUICastButton](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button) (iOS)
* @see [CastButtonFactory](https://developers.google.com/android/reference/com/google/android/gms/cast/framework/CastButtonFactory) & [MediaRouteButton](https://developer.android.com/reference/android/support/v7/app/MediaRouteButton.html) (Android)
*/
class CastButton extends React.Component {
render() {
if (GoogleCast.CAST_AVAILABLE) {
return <GoogleCastButton {...this.props} />;
} else {
return null;
}
}
}
CastButton.propTypes = {
/**
* A flag that indicates whether a touch event on this button will trigger the display of the Cast dialog that is provided by the framework.
*
* By default this property is set to YES. If an application wishes to handle touch events itself, it should set the property to NO and register an appropriate target and action for the touch event.
* */
// triggersDefaultCastDialog: PropTypes.bool
// accessibilityLabel: PropTypes.string
}
var GoogleCastButton = requireNativeComponent(
'RNGoogleCastButton',
CastButton,
{
nativeOnly: {
accessibilityLabel: true,
accessibilityLiveRegion: true,
accessibilityComponentType: true,
testID: true,
nativeID: true,
importantForAccessibility: true,
renderToHardwareTextureAndroid: true,
onLayout: true,
},
},
)
export default CastButton