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>,
|
...OptionalProps<SectionT>,
|
||||||
|};
|
|};
|
||||||
|
|
||||||
const defaultProps = {
|
|
||||||
stickySectionHeadersEnabled: Platform.OS === 'ios',
|
|
||||||
};
|
|
||||||
|
|
||||||
type DefaultProps = typeof defaultProps;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A performant interface for rendering sectioned lists, supporting the most handy features:
|
* 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,
|
void,
|
||||||
> {
|
> {
|
||||||
props: Props<SectionT>;
|
props: Props<SectionT>;
|
||||||
static defaultProps: DefaultProps = defaultProps;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scrolls to the item at the specified `sectionIndex` and `itemIndex` (within the section)
|
* 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 {
|
render(): React.Node {
|
||||||
|
const {
|
||||||
|
stickySectionHeadersEnabled: _stickySectionHeadersEnabled,
|
||||||
|
...restProps
|
||||||
|
} = this.props;
|
||||||
|
const stickySectionHeadersEnabled =
|
||||||
|
_stickySectionHeadersEnabled ?? Platform.OS === 'ios';
|
||||||
return (
|
return (
|
||||||
<VirtualizedSectionList
|
<VirtualizedSectionList
|
||||||
{...this.props}
|
{...restProps}
|
||||||
|
stickySectionHeadersEnabled={stickySectionHeadersEnabled}
|
||||||
ref={this._captureRef}
|
ref={this._captureRef}
|
||||||
getItemCount={items => items.length}
|
getItemCount={items => items.length}
|
||||||
getItem={(items, index) => items[index]}
|
getItem={(items, index) => items[index]}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче