@theoplayer/react-native-ui
Version:
A React Native UI for @theoplayer/react-native
51 lines (49 loc) • 1.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.MenuRadioButton = exports.DEFAULT_MENU_BUTTON_STYLE = void 0;
var _reactNative = require("react-native");
var _react = _interopRequireDefault(require("react"));
var _PlayerContext = require("../../util/PlayerContext");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* The default style for the menu button.
*/
const DEFAULT_MENU_BUTTON_STYLE = exports.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.
*/
const MenuRadioButton = props => {
const {
uid,
onSelect,
label,
selected,
style
} = props;
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
onPress: () => {
onSelect(uid);
},
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PlayerContext.PlayerContext.Consumer, {
children: context => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.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
})
})
});
};
exports.MenuRadioButton = MenuRadioButton;
//# sourceMappingURL=MenuRadioButton.js.map