@livelike/react-native
Version:
LiveLike React Native package
18 lines (14 loc) • 548 B
text/typescript
import { useWidgetSelectedOptionIndex } from './useWidgetSelectedOptionIndex';
import { useIsWidgetDisabled } from './useIsWidgetDisabled';
export type UseIsWidgetOptionDisabledArg = {
widgetId: string;
optionIndex: number;
};
export const useIsWidgetOptionDisabled = ({
widgetId,
optionIndex,
}: UseIsWidgetOptionDisabledArg) => {
const selectedOptionIndex = useWidgetSelectedOptionIndex({ widgetId });
const isWidgetDisabled = useIsWidgetDisabled({ widgetId });
return isWidgetDisabled || selectedOptionIndex === optionIndex;
};