Skip to content

Commit

Permalink
Add LayoutOrder to PageController.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vorlias committed Jan 17, 2023
1 parent 861e7f3 commit 2d973ff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rbxts/zenui-core",
"version": "0.6.1",
"version": "0.6.2",
"description": "",
"main": "out/init.lua",
"scripts": {
Expand Down
9 changes: 8 additions & 1 deletion src/Controllers/PageController.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import Roact from "@rbxts/roact";
import { InferEnumNames } from "../Utility/Types";

export interface PageControllerProps {
Size?: UDim2;
Position?: UDim2;
SortOrder?: InferEnumNames<Enum.SortOrder> | Enum.SortOrder;
SelectedPageIndex: number;
TabIndexChanged?: (index: number) => void;
}
Expand Down Expand Up @@ -49,7 +51,12 @@ export class PageController extends Roact.PureComponent<PageControllerProps, Pag

return (
<frame ZIndex={2} ClipsDescendants BackgroundTransparency={1} Size={ContentSize} Position={ContentPosition}>
<uipagelayout ScrollWheelInputEnabled={false} Animated={false} Ref={(page) => (this.page = page)} />
<uipagelayout
SortOrder={this.props.SortOrder}
ScrollWheelInputEnabled={false}
Animated={false}
Ref={(page) => (this.page = page)}
/>
{children}
</frame>
);
Expand Down
4 changes: 3 additions & 1 deletion src/Layouts/ColumnView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ export class ColumnView extends Roact.Component<ColumnViewProps> {
widthOffset -= colPadding.Offset * (seperatorCount / children.size());
scaleOffset -= colPadding.Scale * (seperatorCount / children.size());

const useAutomaticSize = this.props.ColumnHeight === new UDim();

let idx = 0;
const count = children.size();
for (const [key, child] of children) {
Expand All @@ -185,7 +187,7 @@ export class ColumnView extends Roact.Component<ColumnViewProps> {
this.props.ColumnHeight.Offset,
)
}
AutomaticSize={this.props.ColumnHeight === new UDim() ? "Y" : "None"}
AutomaticSize={useAutomaticSize ? "Y" : "None"}
>
<uilistlayout
VerticalAlignment={props.VerticalAlignment}
Expand Down

0 comments on commit 2d973ff

Please sign in to comment.