react-native-ios-utilities
Version:
Utilities for react-native + iOS and wrappers for using swift together with fabric/paper + JSI
56 lines (55 loc) • 2.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.CircleView = CircleView;
exports.TriangleView = TriangleView;
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
function TriangleView(props) {
const {
width,
height,
color
} = props;
const shapeWidth = width ?? (height == null ? width : 30);
const shapeHeight = height ?? (width == null ? height : 30);
const containerStyle = {
borderLeftWidth: shapeHeight,
borderRightWidth: shapeHeight,
borderBottomWidth: shapeWidth,
borderBottomColor: color ?? "red"
};
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
style: [styles.triangleContainer, containerStyle, props.style],
children: props.children
});
}
;
function CircleView(props) {
const size = props.size ?? 30;
const containerStyle = {
height: size,
aspectRatio: 1,
borderRadius: size / 2,
backgroundColor: props.color ?? 'white'
};
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
style: [containerStyle, props.style],
children: props.children
});
}
;
const styles = _reactNative.StyleSheet.create({
triangleContainer: {
width: 0,
height: 0,
backgroundColor: "transparent",
borderStyle: "solid",
borderLeftColor: "transparent",
borderRightColor: "transparent"
}
});
//# sourceMappingURL=ViewShapes.js.map