NativeScrollView
A customizable ScrollView block for Nativeblocks.
@NativeBlock(
name: "Native ScrollView",
keyType: "NATIVE_SCROLLVIEW",
description: "Nativeblocks ScrollView block",
version: 1
)
struct NativeScrollView<Content: View>: View
NativeScrollView provides a flexible scrollable container for content, with customizable alignment, padding, frame, and appearance settings.
Features:
-
Supports vertical, horizontal, or bidirectional scrolling.
-
Customizable padding, frame, and background.
-
Configurable alignment and scroll indicators visibility.
-
Shadow and border support for enhanced styling.
Example:
NativeScrollView(
content: { index in HStack { Text("Scrollable Content") } }
)
Inheritance
View
Properties
content
The content displayed inside the ScrollView.
@NativeBlockSlot(description: "The scrollable content of the ScrollView.")
var content: (BlockIndex) -> Content
scrollIndicators
Controls the visibility of scroll indicators.
@NativeBlockProp(
description: "Determines the visibility of the scroll indicators.",
valuePicker: NativeBlockValuePicker.DROPDOWN,
valuePickerOptions: [
NativeBlockValuePickerOption("hidden", "hidden"),
NativeBlockValuePickerOption("never", "never"),
NativeBlockValuePickerOption("visible", "visible"),
],
valuePickerGroup: NativeBlockValuePickerPosition("Scrollable")
)
var scrollIndicators: String = "visible"
scrollDirection
Specifies the scrolling direction of the ScrollView.
@NativeBlockProp(
description: "Sets the direction of scrolling (vertical, horizontal, or both).",
valuePicker: NativeBlockValuePicker.DROPDOWN,
valuePickerOptions: [
NativeBlockValuePickerOption("vertical", "vertical"),
NativeBlockValuePickerOption("horizontal", "horizontal"),
NativeBlockValuePickerOption("both", "horizontal"),
],
valuePickerGroup: NativeBlockValuePickerPosition("Scrollable")
)
var scrollDirection: String = "vertical"
alignmentHorizontal
The horizontal alignment of the content inside the ScrollView.
@NativeBlockProp(
description: "Specifies the horizontal alignment of the content.",
valuePicker: NativeBlockValuePicker.DROPDOWN,
valuePickerOptions: [
NativeBlockValuePickerOption("leading", "leading"),
NativeBlockValuePickerOption("trailing", "trailing"),
NativeBlockValuePickerOption("center", "center"),
],
valuePickerGroup: NativeBlockValuePickerPosition("Alignment")
)
var alignmentHorizontal: String = "leading"
alignmentVertical
The vertical alignment of the content inside the ScrollView.
@NativeBlockProp(
description: "Specifies the vertical alignment of the content.",
valuePicker: NativeBlockValuePicker.DROPDOWN,
valuePickerOptions: [
NativeBlockValuePickerOption("top", "top"),
NativeBlockValuePickerOption("bottom", "bottom"),
NativeBlockValuePickerOption("center", "center"),
NativeBlockValuePickerOption("firstTextBaseline", "firstTextBaseline"),
NativeBlockValuePickerOption("lasttextbaseline", "lastTextBaseline"),
],
valuePickerGroup: NativeBlockValuePickerPosition("Alignment")
)
var alignmentVertical: String = "top"
spacing
The spacing between elements inside the ScrollView.
@NativeBlockProp(
description: "The spacing between elements inside the ScrollView.",
valuePickerGroup: NativeBlockValuePickerPosition("Alignment")
)
var spacing: CGFloat = 0
direction
The layout direction of the content (LTR or RTL).
@NativeBlockProp(
description: "Sets the layout direction of the content.",
valuePicker: NativeBlockValuePicker.DROPDOWN,
valuePickerOptions: [
NativeBlockValuePickerOption("LTR", "LTR"),
NativeBlockValuePickerOption("RTL", "RTL"),
],
valuePickerGroup: NativeBlockValuePickerPosition("Direction")
)
var direction: String = "LTR"
paddingTop
The top padding of the content inside the ScrollView.
@NativeBlockProp(
description: "The top padding of the content.",
valuePickerGroup: NativeBlockValuePickerPosition("Padding")
)
var paddingTop: CGFloat = 0
paddingLeading
The leading (left) padding of the content inside the ScrollView.
@NativeBlockProp(
description: "The leading padding of the content.",
valuePickerGroup: NativeBlockValuePickerPosition("Padding")
)
var paddingLeading: CGFloat = 0
paddingBottom
The bottom padding of the content inside the ScrollView.
@NativeBlockProp(
description: "The bottom padding of the content.",
valuePickerGroup: NativeBlockValuePickerPosition("Padding")
)
var paddingBottom: CGFloat = 0
paddingTrailing
The trailing (right) padding of the content inside the ScrollView.
@NativeBlockProp(
description: "The trailing padding of the content.",
valuePickerGroup: NativeBlockValuePickerPosition("Padding")
)
var paddingTrailing: CGFloat = 0
frameWidth
The width of the ScrollView's frame.
@NativeBlockProp(
description: "The width of the ScrollView frame.",
valuePicker: NativeBlockValuePicker.COMBOBOX_INPUT,
valuePickerOptions: [
NativeBlockValuePickerOption("notSet", "notSet"),
NativeBlockValuePickerOption("infinity", "infinity"),
],
valuePickerGroup: NativeBlockValuePickerPosition("Size")
)
var frameWidth: String = "notSet"
frameHeight
The height of the ScrollView's frame.
@NativeBlockProp(
description: "The height of the ScrollView frame.",
valuePicker: NativeBlockValuePicker.COMBOBOX_INPUT,
valuePickerOptions: [
NativeBlockValuePickerOption("notSet", "notSet"),
NativeBlockValuePickerOption("infinity", "infinity"),
],
valuePickerGroup: NativeBlockValuePickerPosition("Size")
)
var frameHeight: String = "notSet"
backgroundColor
The background color of the ScrollView.
@NativeBlockProp(
description: "The background color of the ScrollView.",
valuePicker: NativeBlockValuePicker.COLOR_PICKER,
valuePickerGroup: NativeBlockValuePickerPosition("Background")
)
var backgroundColor: String = "#00000000"
cornerRadius
The corner radius of the ScrollView.
@NativeBlockProp(
description: "The corner radius of the ScrollView.",
valuePickerGroup: NativeBlockValuePickerPosition("Background")
)
var cornerRadius: CGFloat = 0
borderColor
The border color of the ScrollView.
@NativeBlockProp(
description: "The border color of the ScrollView.",
valuePicker: NativeBlockValuePicker.COLOR_PICKER,
valuePickerGroup: NativeBlockValuePickerPosition("Background")
)
var borderColor: String = "#00000000"
borderWidth
The border width of the ScrollView.
@NativeBlockProp(
description: "The border width of the ScrollView.",
valuePickerGroup: NativeBlockValuePickerPosition("Background")
)
var borderWidth: CGFloat = 0
shadowColor
The shadow color of the ScrollView.
@NativeBlockProp(
description: "The shadow color of the ScrollView.",
valuePicker: NativeBlockValuePicker.COLOR_PICKER,
valuePickerGroup: NativeBlockValuePickerPosition("Background")
)
var shadowColor: String = "#00000000"
shadowRadius
The blur radius of the ScrollView's shadow.
@NativeBlockProp(
description: "The blur radius of the ScrollView shadow.",
valuePickerGroup: NativeBlockValuePickerPosition("Background")
)
var shadowRadius: CGFloat = 0
shadowX
The horizontal offset of the ScrollView's shadow.
@NativeBlockProp(
description: "The horizontal offset of the ScrollView shadow.",
valuePickerGroup: NativeBlockValuePickerPosition("Background")
)
var shadowX: CGFloat = 0
shadowY
The vertical offset of the ScrollView's shadow.
@NativeBlockProp(
description: "The vertical offset of the ScrollView shadow.",
valuePickerGroup: NativeBlockValuePickerPosition("Background")
)
var shadowY: CGFloat = 0
onClick
The action triggered when the ScrollView is tapped.
@NativeBlockEvent(description: "The action triggered when the ScrollView is tapped.")
var onClick: () -> Void
body
var body: some View