MCPcopy Index your code
hub / github.com/nodegui/react-nodegui / setGridViewProps

Function setGridViewProps

src/components/GridView/RNGridView.ts:38–71  ·  view source on GitHub ↗
(
  widget: RNGridView,
  newProps: Omit<GridViewProps, "children">,
  oldProps: Omit<GridViewProps, "children">
)

Source from the content-addressed store, hash-verified

36}
37
38const setGridViewProps = (
39 widget: RNGridView,
40 newProps: Omit<GridViewProps, "children">,
41 oldProps: Omit<GridViewProps, "children">
42) => {
43 const setter: Omit<GridViewProps, "children"> = {
44 set horizontalSpacing(spacing: number) {
45 widget.layout()?.setHorizontalSpacing(spacing);
46 },
47 set verticalSpacing(spacing: number) {
48 widget.layout()?.setVerticalSpacing(spacing);
49 },
50 set columnProps(props: GridViewColumnProps) {
51 for (const indexString of Object.keys(props)) {
52 const index = parseInt(indexString, 10);
53 const { stretch, minWidth } = props[index];
54
55 widget.layout()?.setColumnStretch(index, stretch ?? 0);
56 widget.layout()?.setColumnMinimumWidth(index, minWidth ?? 0);
57 }
58 },
59 set rowProps(props: GridViewRowProps) {
60 for (const indexString of Object.keys(props)) {
61 const index = parseInt(indexString, 10);
62 const { stretch, minHeight } = props[index];
63
64 widget.layout()?.setRowStretch(index, stretch ?? 0);
65 widget.layout()?.setRowMinimumHeight(index, minHeight ?? 0);
66 }
67 },
68 };
69 Object.assign(setter, newProps);
70 setViewProps(widget, newProps, oldProps);
71};
72
73/**
74 * @ignore

Callers 2

setPropsMethod · 0.85
appendChildMethod · 0.85

Calls 1

setViewPropsFunction · 0.90

Tested by

no test coverage detected