Remove defaultProps
Summary: Changelog: [Internal] - Remove defaultProps for SectionList Reviewed By: kacieb Differential Revision: D27630645 fbshipit-source-id: 81571fb5f90ea4e820c74781811b82f954f97396
This commit is contained in:
Родитель
683b825b32
Коммит
959dc5ac51
|
@ -116,12 +116,6 @@ export type Props<SectionT> = {|
|
|||
...OptionalProps<SectionT>,
|
||||
|};
|
||||
|
||||
const defaultProps = {
|
||||
stickySectionHeadersEnabled: Platform.OS === 'ios',
|
||||
};
|
||||
|
||||
type DefaultProps = typeof defaultProps;
|
||||
|
||||
/**
|
||||
* A performant interface for rendering sectioned lists, supporting the most handy features:
|
||||
*
|
||||
|
@ -182,7 +176,6 @@ class SectionList<SectionT: SectionBase<any>> extends React.PureComponent<
|
|||
void,
|
||||
> {
|
||||
props: Props<SectionT>;
|
||||
static defaultProps: DefaultProps = defaultProps;
|
||||
|
||||
/**
|
||||
* Scrolls to the item at the specified `sectionIndex` and `itemIndex` (within the section)
|
||||
|
@ -245,9 +238,16 @@ class SectionList<SectionT: SectionBase<any>> extends React.PureComponent<
|
|||
}
|
||||
|
||||
render(): React.Node {
|
||||
const {
|
||||
stickySectionHeadersEnabled: _stickySectionHeadersEnabled,
|
||||
...restProps
|
||||
} = this.props;
|
||||
const stickySectionHeadersEnabled =
|
||||
_stickySectionHeadersEnabled ?? Platform.OS === 'ios';
|
||||
return (
|
||||
<VirtualizedSectionList
|
||||
{...this.props}
|
||||
{...restProps}
|
||||
stickySectionHeadersEnabled={stickySectionHeadersEnabled}
|
||||
ref={this._captureRef}
|
||||
getItemCount={items => items.length}
|
||||
getItem={(items, index) => items[index]}
|
||||
|
|
Загрузка…
Ссылка в новой задаче