Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/pluggableWidgets/switch-native/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Added

- Added the ability to change the position of the label in horizontal view from the left side of the switch to the right side.

### Fixed

- We fixed an issue where the validation message was rendered inside the view container of the switch, which caused incorrect styling of the switch.
- Fixed an issue where

## [1.1.0] - 2024-12-3

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ export function getPreview(values: SwitchPreviewProps, isDarkMode: boolean): Str
document: decodeURIComponent(
(isDarkMode ? StructurePreviewSwitchDarkSVG : StructurePreviewSwitchSVG).replace("data:image/svg+xml,", "")
),
width: 80,
width: 51,
height: 30,
grow: 8
};
const children = values.showLabel ? [label, image] : [image];

const children = values.showLabel ? (values.labelPosition === "right" ? [image, label] : [label, image]) : [image];
return values.labelOrientation === "horizontal"
? {
type: "RowLayout",
Expand All @@ -48,7 +47,11 @@ export function getPreview(values: SwitchPreviewProps, isDarkMode: boolean): Str

export function getProperties(values: SwitchPreviewProps, defaultProperties: Properties): Properties {
if (!values.showLabel) {
hidePropertiesIn(defaultProperties, values, ["label", "labelOrientation"]);
hidePropertiesIn(defaultProperties, values, ["label", "labelOrientation", "labelPosition"]);
}

if (values.showLabel && values.labelOrientation !== "horizontal") {
hidePropertiesIn(defaultProperties, values, ["labelPosition"]);
}

return defaultProperties;
Expand Down