Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

workspace-content-width.ts

19 lines903 Bytes

1import { createContext, use } from "react";
2import type { SharedValue } from "react-native-reanimated";
3​
4// Floating controls follow the visible pane while the expensive navigator/feed
5// stays laid out at its settled width during sidebar and inspector transitions.
6export const WorkspaceContentWidthContext = createContext<SharedValue<number> | null>(null);
7​
8export function useWorkspaceContentWidth() {
9 return use(WorkspaceContentWidthContext);
11​
12// The settled width itself. The feed lays its rows out at this width in the same commit that
13// resizes the pane; waiting for its own onLayout re-measured every row twice, once against the
14// old text widths, and the list jumped while it repositioned them.
15export const WorkspaceSettledContentWidthContext = createContext<number | null>(null);
16​
17export function useWorkspaceSettledContentWidth() {
18 return use(WorkspaceSettledContentWidthContext);