Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 448aaac

Browse files
authored
fix(List): remove listRef from API (#489)
* remove listRef from List API * update changelog
1 parent df2a657 commit 448aaac

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
3333
- Fix Teams Icons styles to match spec @codepretty ([#441](https://github.com/stardust-ui/react/pull/441))
3434
- Fix styles as functions in shorthands are not applied @mnajdova ([#470](https://github.com/stardust-ui/react/pull/470))
3535
- Add `lodash` typings and fix compilation errors @Bugaa92 ([#438](https://github.com/stardust-ui/react/pull/438))
36+
- Remove unsafe `listRef` from `List` API @kuzhelov ([#489](https://github.com/stardust-ui/react/pull/489))
3637

3738
### Features
3839
- Make `Grid` keyboard navigable by implementing `gridBehavior` @sophieH29 ([#398](https://github.com/stardust-ui/react/pull/398))

src/components/List/List.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ export interface ListProps extends UIComponentProps<any, any>, ChildrenComponent
2626
/** Shorthand array of props for ListItem. */
2727
items?: ShorthandValue[]
2828

29-
/** Ref callback with the list DOM node. */
30-
listRef?: (node: HTMLElement) => void
31-
3229
/** A selection list formats list items as possible choices. */
3330
selection?: boolean
3431

@@ -70,7 +67,6 @@ class List extends UIComponent<Extendable<ListProps>, ListState> {
7067
selection: PropTypes.bool,
7168
truncateContent: PropTypes.bool,
7269
truncateHeader: PropTypes.bool,
73-
listRef: PropTypes.func,
7470
renderItem: PropTypes.func,
7571
}
7672

@@ -91,10 +87,6 @@ class List extends UIComponent<Extendable<ListProps>, ListState> {
9187
private focusHandler: ContainerFocusHandler = null
9288
private itemRefs = []
9389

94-
private handleListRef = (listNode: HTMLElement) => {
95-
_.invoke(this.props, 'listRef', listNode)
96-
}
97-
9890
actionHandlers: AccessibilityActionHandlers = {
9991
moveNext: e => {
10092
e.preventDefault()
@@ -123,7 +115,6 @@ class List extends UIComponent<Extendable<ListProps>, ListState> {
123115
{...accessibility.keyHandlers.root}
124116
{...rest}
125117
className={classes.root}
126-
ref={this.handleListRef}
127118
>
128119
{childrenExist(children) ? children : this.renderItems()}
129120
</ElementType>

0 commit comments

Comments
 (0)