Let composer controls adapt to narrow panes (#1270)
This commit is contained in:
@@ -20,11 +20,14 @@ export function useContainerWidth(): {
|
||||
/**
|
||||
* Tracks only whether a container is narrower than a threshold.
|
||||
*/
|
||||
export function useContainerWidthBelow(threshold: number): {
|
||||
export function useContainerWidthBelow(
|
||||
threshold: number,
|
||||
options?: { initialIsBelow?: boolean },
|
||||
): {
|
||||
onLayout: (e: LayoutChangeEvent) => void;
|
||||
isBelow: boolean;
|
||||
} {
|
||||
const [isBelow, setIsBelow] = useState(true);
|
||||
const [isBelow, setIsBelow] = useState(options?.initialIsBelow ?? true);
|
||||
return {
|
||||
onLayout: useCallback(
|
||||
(e: LayoutChangeEvent) => {
|
||||
|
||||
Reference in New Issue
Block a user