Skip to content

Commit 031cc54

Browse files
committed
feat: use the new AVRoutePickerView when available
1 parent d361d65 commit 031cc54

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

ios/RNAirPlayButtonManager.m

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,17 @@ @implementation RNAirPlayButtonManager
1212

1313
- (UIView *)view
1414
{
15-
MPVolumeView *volumeView = [[MPVolumeView alloc] init];
16-
volumeView.showsVolumeSlider = false;
17-
18-
return volumeView;
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+
}
1926
}
2027

2128
@end

0 commit comments

Comments
 (0)