From 7c1216091823c4469ec1fa06c4012f920af01f69 Mon Sep 17 00:00:00 2001 From: flochtililoch Date: Mon, 11 Apr 2022 21:54:10 -0700 Subject: [PATCH] feat: Allow scroll bars in scroll views to be hidden Resolves #377. Notes: - Update docs for ``, `
` and `` - Update schema - Add examples for scroll view and list view - `` **does not** implement this property, it does not seem supported by RN --- docs/reference_body.md | 9 ++ docs/reference_form.md | 27 ++++ docs/reference_list.md | 18 +++ docs/reference_view.md | 9 ++ .../ui_elements/list/hidden_scroll_bar.xml | 118 ++++++++++++++++++ examples/ui_elements/list/horizontal.xml | 118 ++++++++++++++++++ examples/ui_elements/list/index.xml | 18 +++ examples/ui_elements/scroll_view.xml | 36 +++++- schema/hyperview.xsd | 2 +- src/components/hv-view/index.js | 14 ++- 10 files changed, 360 insertions(+), 9 deletions(-) create mode 100644 examples/ui_elements/list/hidden_scroll_bar.xml create mode 100644 examples/ui_elements/list/horizontal.xml diff --git a/docs/reference_body.md b/docs/reference_body.md index 8691a119c..feae3422f 100644 --- a/docs/reference_body.md +++ b/docs/reference_body.md @@ -36,6 +36,7 @@ A `` element can only appear as a direct child of a `` element. Th - [`style`](#style) - [`scroll`](#scroll) - [`scroll-orientation`](#scroll-orientation) +- [`shows-scroll-indicator`](#shows-scroll-indicator) - [`id`](#id) #### Behavior attributes @@ -74,6 +75,14 @@ An attribute indicating whether the content in the can be scrollable. The style An attribute indicating the direction in which the body will scroll. +#### `shows-scroll-indicator` + +| Type | Required | +| ------------------------- | -------- | +| **true** (default), false | No | + +An attribute indicating whether the scroll bar should be shown. Attribute `scroll` should be set in for this to have any effect. + #### `id` | Type | Required | diff --git a/docs/reference_form.md b/docs/reference_form.md index 09b5e6ca6..c9f8da734 100644 --- a/docs/reference_form.md +++ b/docs/reference_form.md @@ -60,6 +60,9 @@ A `` element can appear anywhere within a `` element. It can conta - [`style`](#style) - [`id`](#id) - [`hide`](#hide) +- [`scroll`](#scroll) +- [`scroll-orientation`](#scroll-orientation) +- [`shows-scroll-indicator`](#shows-scroll-indicator) #### `style` @@ -84,3 +87,27 @@ A global attribute uniquely identifying the element in the whole document. | **false** (default), true | No | If `hide="true"`, the element will not be rendered on screen. If the element or any of the element's children have a behavior that triggers on "load" or "visible", those behaviors will not trigger while the element is hidden. + +#### `scroll` + +| Type | Required | +| ------------------------- | -------- | +| true, **false** (default) | No | + +An attribute indicating whether the content in the can be scrollable. The style rules of the body will determine the viewport size. + +#### `scroll-orientation` + +| Type | Required | +| ---------------------------------- | -------- | +| **vertical** (default), horizontal | No | + +An attribute indicating the direction in which the body will scroll. + +#### `shows-scroll-indicator` + +| Type | Required | +| ------------------------- | -------- | +| **true** (default), false | No | + +An attribute indicating whether the scroll bar should be shown. Attribute `scroll` should be set in for this to have any effect. diff --git a/docs/reference_list.md b/docs/reference_list.md index 2c0d50457..3d38625fc 100644 --- a/docs/reference_list.md +++ b/docs/reference_list.md @@ -33,6 +33,8 @@ A `` element will only render `` and `` children elements. Ot - [`itemHeight`](#itemheight) - [`id`](#id) - [`hide`](#hide) +- [`scroll-orientation`](#scroll-orientation) +- [`shows-scroll-indicator`](#shows-scroll-indicator) #### Behavior attributes @@ -69,3 +71,19 @@ A global attribute uniquely identifying the element in the whole document. | **false** (default), true | No | If `hide="true"`, the element will not be rendered on screen. If the element or any of the element's children have a behavior that triggers on "load" or "visible", those behaviors will not trigger while the element is hidden. + +#### `scroll-orientation` + +| Type | Required | +| ---------------------------------- | -------- | +| **vertical** (default), horizontal | No | + +An attribute indicating the direction in which the body will scroll. + +#### `shows-scroll-indicator` + +| Type | Required | +| ------------------------- | -------- | +| **true** (default), false | No | + +An attribute indicating whether the scroll bar should be shown. diff --git a/docs/reference_view.md b/docs/reference_view.md index d46fb3832..435ea7f02 100644 --- a/docs/reference_view.md +++ b/docs/reference_view.md @@ -55,6 +55,7 @@ A `` element can only appear anywhere within a `` element. - [`scroll`](#scroll) - [`scroll-orientation`](#scroll-orientation) - [`scroll-to-input-offset`](#scroll-to-input-offset) +- [`shows-scroll-indicator`](#shows-scroll-indicator) - [`id`](#id) - [`hide`](#hide) - [`avoid-keyboard`](#avoid-keyboard) @@ -103,6 +104,14 @@ An attribute indicating the direction in which the view will scroll. An attribute defining an additional scroll offset to be applied to the view, when a `` or `` is focused. Only valid in combination with attribute `scroll` set to `"true"`. +#### `shows-scroll-indicator` + +| Type | Required | +| ------------------------- | -------- | +| **true** (default), false | No | + +An attribute indicating whether the scroll bar should be shown. Attribute `scroll` should be set in for this to have any effect. + #### `id` | Type | Required | diff --git a/examples/ui_elements/list/hidden_scroll_bar.xml b/examples/ui_elements/list/hidden_scroll_bar.xml new file mode 100644 index 000000000..6d8ec2257 --- /dev/null +++ b/examples/ui_elements/list/hidden_scroll_bar.xml @@ -0,0 +1,118 @@ + + + +