UNPKG

@wordpress/components

Version:
48 lines (43 loc) 1.29 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement } from "@wordpress/element"; /** * External dependencies */ import { Switch } from 'react-native'; /** * WordPress dependencies */ import { __, _x, sprintf } from '@wordpress/i18n'; /** * Internal dependencies */ import Cell from './cell'; export default function BottomSheetSwitchCell(props) { const { value, onValueChange, ...cellProps } = props; const onPress = () => { onValueChange(!value); }; const accessibilityLabel = value ? sprintf( /* translators: accessibility text. Switch setting ON state. %s: Switch title. */ _x('%s. On', 'switch control'), cellProps.label) : sprintf( /* translators: accessibility text. Switch setting OFF state. %s: Switch title. */ _x('%s. Off', 'switch control'), cellProps.label); return createElement(Cell, _extends({}, cellProps, { accessibilityLabel: accessibilityLabel, accessibilityRole: 'none', accessibilityHint: /* translators: accessibility text (hint for switches) */ __('Double tap to toggle setting'), onPress: onPress, editable: false, value: '' }), createElement(Switch, { value: value, onValueChange: onValueChange })); } //# sourceMappingURL=switch-cell.native.js.map