UNPKG

@wordpress/components

Version:
48 lines (43 loc) 1.02 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement } from "@wordpress/element"; /** * External dependencies */ import { find } from 'lodash'; /** * Internal dependencies */ import Cell from './cell'; import Picker from '../picker'; export default function BottomSheetPickerCell(props) { const { options, hideCancelButton, onChangeValue, value, ...cellProps } = props; let picker; const onCellPress = () => { picker.presentPicker(); }; const onChange = newValue => { onChangeValue(newValue); }; const option = find(options, { value }); const label = option ? option.label : value; return createElement(Cell, _extends({ onPress: onCellPress, editable: false, value: label }, cellProps), createElement(Picker, { leftAlign: true, hideCancelButton: hideCancelButton, ref: instance => picker = instance, options: options, onChange: onChange })); } //# sourceMappingURL=picker-cell.native.js.map