rn-custom-style-sheet
Version:
React Native component to select a specific value from a range of values.
14 lines • 712 B
JavaScript
import { useWindowDimensions } from 'react-native';
import { getBreakpointValueByIndex, getCurrentBreakpointIndex, hasValidBreakpointPropertyFormat } from '../../Utils';
import { useGuideLineBreakpoint } from '../../../Core';
export default function useBreakpoint(values) {
const screenWidth = useWindowDimensions().width;
const guideLineBreakpoint = useGuideLineBreakpoint();
if (hasValidBreakpointPropertyFormat(values, guideLineBreakpoint)) {
const breakpointIndex = getCurrentBreakpointIndex(guideLineBreakpoint.values, screenWidth);
return getBreakpointValueByIndex(values, breakpointIndex, guideLineBreakpoint);
} else {
return undefined;
}
}
//# sourceMappingURL=UseBreakpoint.js.map