vd-plugins/nexxstuff/components/InlineCheckbox.tsx
kmmiio99o b98ce51645
feat: add nexx lib and better Header text
nexx shouldn't be mad, right?
2026-01-25 17:09:24 +01:00

43 lines
875 B
TypeScript

import { find } from "@vendetta/metro";
import { React, ReactNative as RN } from "@vendetta/metro/common";
import Text from "./Text";
const { FormCheckbox } = find(x => x?.FormCheckbox && !x?.FormCardSection);
export default function InlineCheckbox({
label,
initialValue,
update,
}: {
label: string;
initialValue: boolean;
update: (val: boolean) => void;
}) {
const [value, setValue] = React.useState(initialValue);
update(value);
return (
<RN.Pressable
accessibilityLabel={label}
accessibilityRole="checkbox"
accessibilityState={{
selected: value,
}}
onPress={() => {
setValue(!value);
}}
style={{
flexDirection: "row",
alignItems: "center",
gap: 8,
marginTop: 12,
}}
>
<FormCheckbox checked={value} />
<Text variant="text-md/normal" color="TEXT_DEFAULT">
{label}
</Text>
</RN.Pressable>
);
}