@sudobility/components-rn 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +26 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +26 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/ui/AspectFitView/AspectFitView.d.ts +27 -0
- package/dist/ui/AspectFitView/AspectFitView.d.ts.map +1 -0
- package/dist/ui/AspectFitView/index.d.ts +2 -0
- package/dist/ui/AspectFitView/index.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/ui/AspectFitView/AspectFitView.tsx +74 -0
- package/src/ui/AspectFitView/index.ts +1 -0
package/dist/index.cjs.js
CHANGED
|
@@ -5117,6 +5117,31 @@ const AspectRatio = ({
|
|
|
5117
5117
|
}
|
|
5118
5118
|
);
|
|
5119
5119
|
};
|
|
5120
|
+
const AspectFitView = ({
|
|
5121
|
+
aspectRatio,
|
|
5122
|
+
children,
|
|
5123
|
+
className,
|
|
5124
|
+
innerClassName
|
|
5125
|
+
}) => {
|
|
5126
|
+
const [size, setSize] = React__namespace.useState(null);
|
|
5127
|
+
const onLayout = React__namespace.useCallback((event) => {
|
|
5128
|
+
const { width, height } = event.nativeEvent.layout;
|
|
5129
|
+
setSize({ width, height });
|
|
5130
|
+
}, []);
|
|
5131
|
+
let innerWidth = 0;
|
|
5132
|
+
let innerHeight = 0;
|
|
5133
|
+
if (size) {
|
|
5134
|
+
const parentRatio = size.width / size.height;
|
|
5135
|
+
if (aspectRatio > parentRatio) {
|
|
5136
|
+
innerWidth = size.width;
|
|
5137
|
+
innerHeight = size.width / aspectRatio;
|
|
5138
|
+
} else {
|
|
5139
|
+
innerHeight = size.height;
|
|
5140
|
+
innerWidth = size.height * aspectRatio;
|
|
5141
|
+
}
|
|
5142
|
+
}
|
|
5143
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.View, { className: cn("flex-1", className), onLayout, children: size && /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.View, { className: cn("items-center", innerClassName), children: /* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.ScrollView, { style: { width: innerWidth, height: innerHeight }, children }) }) });
|
|
5144
|
+
};
|
|
5120
5145
|
const QuickActions = ({
|
|
5121
5146
|
actions,
|
|
5122
5147
|
orientation = "horizontal",
|
|
@@ -10167,6 +10192,7 @@ exports.AlertDescription = AlertDescription;
|
|
|
10167
10192
|
exports.AlertTitle = AlertTitle;
|
|
10168
10193
|
exports.AnimatedCounter = AnimatedCounter;
|
|
10169
10194
|
exports.AnimatedSection = AnimatedSection;
|
|
10195
|
+
exports.AspectFitView = AspectFitView;
|
|
10170
10196
|
exports.AspectRatio = AspectRatio;
|
|
10171
10197
|
exports.Avatar = Avatar;
|
|
10172
10198
|
exports.AvatarGroup = AvatarGroup;
|