( widget: RNGridView, newProps: Omit<GridViewProps, "children">, oldProps: Omit<GridViewProps, "children"> )
| 36 | } |
| 37 | |
| 38 | const 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 |
no test coverage detected