Merge pull request 'fix(mobile): keep AirPlay button size and color consistent' (#50) from t3/keep-airplay-button-style into main
This commit was merged in pull request #50.
This commit is contained in:
commit
1d04d0d146
1 file changed
+15
-2
@@ -7,24 +7,37 @@ public class AudioOutputModule: Module {
|
||||
|
||||
View(AudioOutputView.self) {
|
||||
Prop("tint") { (view: AudioOutputView, color: UIColor) in
|
||||
view.picker.tintColor = color
|
||||
view.icon.tintColor = color
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final class AudioOutputView: ExpoView {
|
||||
let picker = AVRoutePickerView()
|
||||
private let picker = AVRoutePickerView()
|
||||
let icon = UIImageView(
|
||||
image: UIImage(
|
||||
systemName: "airplay.audio",
|
||||
withConfiguration: UIImage.SymbolConfiguration(pointSize: 27, weight: .semibold)
|
||||
)
|
||||
)
|
||||
|
||||
required init(appContext: AppContext? = nil) {
|
||||
super.init(appContext: appContext)
|
||||
picker.prioritizesVideoDevices = false
|
||||
picker.backgroundColor = .clear
|
||||
// Keep the native picker interactive without its route-dependent icon styling.
|
||||
picker.layer.opacity = 0
|
||||
addSubview(picker)
|
||||
icon.contentMode = .center
|
||||
icon.isUserInteractionEnabled = false
|
||||
icon.isAccessibilityElement = false
|
||||
addSubview(icon)
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
picker.frame = bounds
|
||||
icon.frame = bounds
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user