From 50b99274eedb2c0cdefec73c18f305c72c950dd4 Mon Sep 17 00:00:00 2001 From: fabriziobertoglio1987 Date: Mon, 11 Jul 2022 12:07:44 +0800 Subject: [PATCH 1/3] adding AccessibilityCollectionItem type and flatlist#renderItem accessibilityCollectionItem docum --- docs/flatlist.md | 29 ++++++++++++++++++++++++++--- docs/virtualizedlist.md | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 3 deletions(-) diff --git a/docs/flatlist.md b/docs/flatlist.md index 0398e1181c3..e29e2474be9 100644 --- a/docs/flatlist.md +++ b/docs/flatlist.md @@ -181,7 +181,12 @@ Inherits [ScrollView Props](scrollview.md#props), unless it is nested in another ###
Required
**`renderItem`** ```jsx -renderItem({ item, index, separators }); +renderItem({ + item, + index, + separators, + accessibilityCollectionItem +}); ``` Takes an item from `data` and renders it into the list. @@ -195,12 +200,22 @@ Provides additional metadata like `index` if you need it, as well as a more gene - `item` (Object): The item from `data` being rendered. - `index` (number): The index corresponding to this item in the `data` array. - `separators` (Object) + - `highlight` (Function) - `unhighlight` (Function) - `updateProps` (Function) - `select` (enum('leading', 'trailing')) - `newProps` (Object) +- `accessibilityCollectionItem` (Object): + Used by TalkBack to announce the position of the item of a collection (row and column numbers). A collection item is contained in a collection, it starts at a given row and column in the collection, and spans one or more rows and columns. For example, a header of two related table columns starts at the first row and the first column, spans one row and two columns. + - itemIndex + - rowIndex The row index at which the item is located. + - rowSpan The number of rows the item spans. + - columnIndex The column index at which the item is located. + - columnSpan The number of columns the item spans. + - heading Whether the item is a heading. + Example usage: ```jsx @@ -217,13 +232,21 @@ Example usage: )) } data={[{ title: 'Title Text', key: 'item1' }]} - renderItem={({ item, index, separators }) => ( + renderItem={({ + item, + index, + separators, + accessibilityCollectionItem + }) => ( this._onPress(item)} onShowUnderlay={separators.highlight} onHideUnderlay={separators.unhighlight}> - + {item.title} diff --git a/docs/virtualizedlist.md b/docs/virtualizedlist.md index b1abd2c3ac0..724b2903999 100644 --- a/docs/virtualizedlist.md +++ b/docs/virtualizedlist.md @@ -123,6 +123,20 @@ Determines how many items are in the data blob. --- +### **`getCellsInItemCount`** + +```jsx +(data: any) => number; +``` + +Determines how many cells are in the data blob + +| Type | +| -------- | +| function | + +--- + ###
Required
**`renderItem`** ```jsx @@ -644,3 +658,26 @@ recordInteraction(); ```jsx setNativeProps((props: Object)); ``` + +## Type Definitions + +### AccessibilityCollectionItem + +Used by TalkBack to announce the position of the item of a collection (row and column numbers). +Information if a node is a collection item. A collection item is contained in a collection, it starts at a given row and column in the collection, and spans one or +more rows and columns. For example, a header of two related table columns starts at the first row and the first column, spans one row and two columns. + +| Type | +| ------ | +| object | + +|
Name
| Type | Description | +| -------------------------------------- | ------ | --------------------------------------------- | +| itemIndex | string | | +| rowIndex | string | The row index at which the item is located | +| rowSpan | string | The number of rows the item spans | +| columnIndex | string | The column index at which the item is located | +| columnIndex | string | The column index at which the item is located | +| columnIndex | string | The column index at which the item is located | +| columnSpan | string | The number of columns the item spans | +| heading | string | Whether the item is a heading | From 2679d451ed083caa076705fec682a7ce103f2e41 Mon Sep 17 00:00:00 2001 From: fabriziobertoglio1987 Date: Mon, 11 Jul 2022 12:13:32 +0800 Subject: [PATCH 2/3] adding description for itemIndex --- docs/flatlist.md | 2 +- docs/virtualizedlist.md | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/flatlist.md b/docs/flatlist.md index e29e2474be9..b3f898b5b42 100644 --- a/docs/flatlist.md +++ b/docs/flatlist.md @@ -209,7 +209,7 @@ Provides additional metadata like `index` if you need it, as well as a more gene - `accessibilityCollectionItem` (Object): Used by TalkBack to announce the position of the item of a collection (row and column numbers). A collection item is contained in a collection, it starts at a given row and column in the collection, and spans one or more rows and columns. For example, a header of two related table columns starts at the first row and the first column, spans one row and two columns. - - itemIndex + - itemIndex The index of the item in the collection (index of prop.data). - rowIndex The row index at which the item is located. - rowSpan The number of rows the item spans. - columnIndex The column index at which the item is located. diff --git a/docs/virtualizedlist.md b/docs/virtualizedlist.md index 724b2903999..f076b86d922 100644 --- a/docs/virtualizedlist.md +++ b/docs/virtualizedlist.md @@ -671,13 +671,13 @@ more rows and columns. For example, a header of two related table columns starts | ------ | | object | -|
Name
| Type | Description | -| -------------------------------------- | ------ | --------------------------------------------- | -| itemIndex | string | | -| rowIndex | string | The row index at which the item is located | -| rowSpan | string | The number of rows the item spans | -| columnIndex | string | The column index at which the item is located | -| columnIndex | string | The column index at which the item is located | -| columnIndex | string | The column index at which the item is located | -| columnSpan | string | The number of columns the item spans | -| heading | string | Whether the item is a heading | +|
Name
| Type | Description | +| -------------------------------------- | ------ | ------------------------------------------------------------ | +| itemIndex | string | The index of the item in the collection (index of prop.data) | +| rowIndex | string | The row index at which the item is located | +| rowSpan | string | The number of rows the item spans | +| columnIndex | string | The column index at which the item is located | +| columnIndex | string | The column index at which the item is located | +| columnIndex | string | The column index at which the item is located | +| columnSpan | string | The number of columns the item spans | +| heading | string | Whether the item is a heading | From 404e392382e5d3cbead1d1e019b69db55d5e2e56 Mon Sep 17 00:00:00 2001 From: fabriziobertoglio1987 Date: Mon, 11 Jul 2022 12:17:01 +0800 Subject: [PATCH 3/3] remove empty lines --- docs/flatlist.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/flatlist.md b/docs/flatlist.md index b3f898b5b42..c817f303947 100644 --- a/docs/flatlist.md +++ b/docs/flatlist.md @@ -200,13 +200,11 @@ Provides additional metadata like `index` if you need it, as well as a more gene - `item` (Object): The item from `data` being rendered. - `index` (number): The index corresponding to this item in the `data` array. - `separators` (Object) - - `highlight` (Function) - `unhighlight` (Function) - `updateProps` (Function) - `select` (enum('leading', 'trailing')) - `newProps` (Object) - - `accessibilityCollectionItem` (Object): Used by TalkBack to announce the position of the item of a collection (row and column numbers). A collection item is contained in a collection, it starts at a given row and column in the collection, and spans one or more rows and columns. For example, a header of two related table columns starts at the first row and the first column, spans one row and two columns. - itemIndex The index of the item in the collection (index of prop.data).