File tree Expand file tree Collapse file tree 5 files changed +33
-22
lines changed
Expand file tree Collapse file tree 5 files changed +33
-22
lines changed Original file line number Diff line number Diff line change 11# react-native-airplay-cast
22
3- Stream audio or video to AirPlay-enabled devices.
3+ Stream audio or video to AirPlay-enabled devices with a customizable AirPlay button .
44
55## Installation
66
@@ -13,9 +13,11 @@ npm install react-native-airplay-cast
1313``` js
1414import { AirPlayButton } from " react-native-airplay-cast" ;
1515
16- // ...
17-
18- < AirPlayButton style= {{ width: 30 , height: 30 }} / >
16+ < AirPlayButton
17+ activeTintColor= " blue"
18+ tintColor= " black"
19+ style= {{ width: 30 , height: 30 }}
20+ / >
1921```
2022
2123## Contributing
Original file line number Diff line number Diff line change @@ -5,7 +5,11 @@ import { AirPlayButton } from 'react-native-airplay-cast';
55export default function App ( ) {
66 return (
77 < View style = { styles . container } >
8- < AirPlayButton />
8+ < AirPlayButton
9+ activeTintColor = "blue"
10+ tintColor = "black"
11+ style = { styles . button }
12+ />
913 </ View >
1014 ) ;
1115}
@@ -16,4 +20,8 @@ const styles = StyleSheet.create({
1620 alignItems : 'center' ,
1721 justifyContent : 'center' ,
1822 } ,
23+ button : {
24+ width : 30 ,
25+ height : 30 ,
26+ } ,
1927} ) ;
Original file line number Diff line number Diff line change 11#import < React/RCTViewManager.h>
22#import < Foundation/Foundation.h>
3- #import < AVFoundation/AVFoundation.h>
4- #import < MediaPlayer/MediaPlayer.h>
3+ #import < AVKit/AVRoutePickerView.h>
54
65@interface RNAirPlayButtonManager : RCTViewManager
76@end
@@ -12,17 +11,11 @@ @implementation RNAirPlayButtonManager
1211
1312- (UIView *)view
1413{
15- if (@available (iOS 11.0 , *)) {
16- AVRoutePickerView *airplayButton = [[AVRoutePickerView alloc ] init ];
17- airplayButton.activeTintColor = [UIColor blueColor ];
18- airplayButton.tintColor = [UIColor whiteColor ];
19- return airplayButton;
20- } else {
21- // If you still support previous iOS versions, you can use MPVolumeView
22- MPVolumeView *airplayButton = [[MPVolumeView alloc ] init ];
23- airplayButton.showsVolumeSlider = NO ;
24- return airplayButton;
25- }
14+ AVRoutePickerView *airPlayButton = [[AVRoutePickerView alloc ] init ];
15+ return airPlayButton;
2616}
2717
18+ RCT_EXPORT_VIEW_PROPERTY (activeTintColor, UIColor);
19+ RCT_EXPORT_VIEW_PROPERTY (tintColor, UIColor);
20+
2821@end
Original file line number Diff line number Diff line change 11{
22 "name" : " react-native-airplay-cast" ,
3- "version" : " 0.1 .0" ,
4- "description" : " Stream audio or video to AirPlay-enabled devices" ,
3+ "version" : " 1.0 .0" ,
4+ "description" : " Stream audio or video to AirPlay-enabled devices with a customizable AirPlay button " ,
55 "main" : " lib/commonjs/index" ,
66 "module" : " lib/module/index" ,
77 "types" : " lib/typescript/src/index.d.ts" ,
Original file line number Diff line number Diff line change 1- import { requireNativeComponent } from 'react-native' ;
1+ import { requireNativeComponent , ViewProps } from 'react-native' ;
22
33// type AirPlayCastType = {
44// };
55
66// const { AirPlayCast } = NativeModules;
77
8- export const AirPlayButton = requireNativeComponent ( 'RNAirPlayButton' ) ;
8+ type AirPlayButtonProps = ViewProps & {
9+ activeTintColor ?: string ;
10+ tintColor ?: string ;
11+ style ?: React . CSSProperties ;
12+ } ;
13+
14+ export const AirPlayButton = requireNativeComponent < AirPlayButtonProps > (
15+ 'RNAirPlayButton'
16+ ) ;
917
1018// export default AirPlayCast as AirPlayCastType;
You can’t perform that action at this time.
0 commit comments