UNPKG

@wordpress/components

Version:
62 lines (57 loc) 1.63 kB
import { createElement } from "@wordpress/element"; /** * External dependencies */ import { Text, TouchableOpacity, View } from 'react-native'; /** * WordPress dependencies */ import { Icon, chevronDown, chevronUp } from '@wordpress/icons'; import { withPreferredColorScheme } from '@wordpress/compose'; /** * Internal dependencies */ import styles from './style.scss'; function Stepper({ getStylesFromColorScheme, isMaxValue, isMinValue, onPressInDecrement, onPressInIncrement, onPressOut, value, shouldDisplayTextInput, children }) { const valueStyle = getStylesFromColorScheme(styles.value, styles.valueTextDark); const buttonIconStyle = getStylesFromColorScheme(styles.buttonNoBg, styles.buttonNoBgTextDark); return createElement(View, { style: styles.container }, createElement(TouchableOpacity, { disabled: isMinValue, onPressIn: onPressInDecrement, onPressOut: onPressOut, style: [styles.buttonNoBg, isMinValue ? { opacity: 0.4 } : null] }, createElement(Icon, { icon: chevronDown, size: 24, color: buttonIconStyle.color })), !shouldDisplayTextInput && createElement(Text, { style: [valueStyle, styles.spacings] }, value), children, createElement(TouchableOpacity, { disabled: isMaxValue, onPressIn: onPressInIncrement, onPressOut: onPressOut, style: [styles.buttonNoBg, isMaxValue ? { opacity: 0.4 } : null] }, createElement(Icon, { icon: chevronUp, size: 24, color: buttonIconStyle.color }))); } export default withPreferredColorScheme(Stepper); //# sourceMappingURL=stepper.android.js.map