UNPKG

react95-native

Version:

Refreshed Windows 95 style UI components for your React Native app

56 lines (51 loc) 1.82 kB
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } import React from 'react'; import { StyleSheet, View } from 'react-native'; import { withTheme } from '../../core/theming'; const pixelSize = 2; const ArrowIcon = ({ color, direction = 'down', disabled = false, segments = 4, shadowOffset, style = {}, theme, ...rest }) => { const segmentSizes = new Array(segments).fill(null).map((_, i) => 1 + i * 2); if (['right', 'down'].includes(direction)) { segmentSizes.reverse(); } const isHorizontal = ['left', 'right'].includes(direction); return /*#__PURE__*/React.createElement(View, _extends({ style: [styles.wrapper, { flexDirection: isHorizontal ? 'row' : 'column' }, style] }, rest), segmentSizes.map((segmentSize, i) => /*#__PURE__*/React.createElement(View, { key: i, style: [styles.segment, { [isHorizontal ? 'height' : 'width']: pixelSize * segmentSize, [isHorizontal ? 'width' : 'height']: pixelSize, backgroundColor: color || (disabled ? theme.materialTextDisabled : theme.materialText), shadowColor: disabled ? theme.materialTextDisabledShadow : 'transparent', shadowOffset: { width: shadowOffset || pixelSize, height: shadowOffset || pixelSize }, shadowOpacity: 1, shadowRadius: 0 }] }))); }; const styles = StyleSheet.create({ wrapper: { position: 'relative', alignItems: 'center' }, segment: { height: pixelSize } }); export default withTheme(ArrowIcon); //# sourceMappingURL=ArrowIcon.js.map