mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 15:48:05 +00:00
Some checks failed
🤖 Android APK Build / 🏗️ Build Android APK (push) Has been cancelled
🤖 iOS IPA Build / 🏗️ Build iOS IPA (push) Has been cancelled
🔒 Lockfile Consistency Check / 🔍 Check bun.lock and package.json consistency (push) Has been cancelled
🛡️ CodeQL Analysis / 🔎 Analyze with CodeQL (javascript-typescript) (push) Has been cancelled
🏷️🔀Merge Conflict Labeler / 🏷️ Labeling Merge Conflicts (push) Has been cancelled
🕒 Handle Stale Issues / 🗑️ Cleanup Stale Issues (push) Has been cancelled
42 lines
806 B
TypeScript
42 lines
806 B
TypeScript
import { View, type ViewProps } from "react-native";
|
|
|
|
const _getItemStyle = (index: number, numColumns: number) => {
|
|
const alignItems = (() => {
|
|
if (numColumns < 2 || index % numColumns === 0) return "flex-start";
|
|
if ((index + 1) % numColumns === 0) return "flex-end";
|
|
|
|
return "center";
|
|
})();
|
|
|
|
return {
|
|
padding: 20,
|
|
alignItems,
|
|
width: "100%",
|
|
} as const;
|
|
};
|
|
|
|
type ColumnItemProps = ViewProps & {
|
|
children: React.ReactNode;
|
|
index: number;
|
|
numColumns: number;
|
|
};
|
|
|
|
export const ColumnItem = ({
|
|
children,
|
|
index,
|
|
numColumns,
|
|
...rest
|
|
}: ColumnItemProps) => {
|
|
return (
|
|
<View className='flex flex-col mb-2 p-4' style={{ width: "33.3%" }}>
|
|
<View
|
|
className={`
|
|
`}
|
|
{...rest}
|
|
>
|
|
{children}
|
|
</View>
|
|
</View>
|
|
);
|
|
};
|