UNPKG

@theoplayer/react-native-ui

Version:

A React Native UI for @theoplayer/react-native

42 lines (41 loc) 1.1 kB
import { Text, TouchableOpacity } from 'react-native'; import React, { useContext } from 'react'; import { PlayerContext } from '../../util/PlayerContext'; import { jsx as _jsx } from "react/jsx-runtime"; /** * The default style for the menu button. */ export const DEFAULT_MENU_BUTTON_STYLE = { fontSize: 16, lineHeight: 24, padding: 10, textAlign: 'center' }; /** * The default radio button that can be used in menus for the `react-native-theoplayer` UI. */ export const MenuRadioButton = props => { const { uid, onSelect, label, selected, style } = props; const context = useContext(PlayerContext); return /*#__PURE__*/_jsx(TouchableOpacity, { onPress: () => { onSelect(uid); }, children: /*#__PURE__*/_jsx(Text, { style: [DEFAULT_MENU_BUTTON_STYLE, selected ? { color: context.style.colors.textSelected, backgroundColor: context.style.colors.textSelectedBackground } : { color: context.style.colors.text }, style], children: label }) }); }; //# sourceMappingURL=MenuRadioButton.js.map