Add inverted option

Reviewed By: bvaughn

Differential Revision: D5210277

fbshipit-source-id: 5a8b196b90a2ac6d20397113ef4bd76446ea9fa3
This commit is contained in:
Spencer Ahrens 2017-06-12 22:33:00 -07:00 committed by Facebook Github Bot
parent 0a3e6e0e76
commit 1d30f833a6
8 changed files with 186 additions and 7 deletions

View File

@ -131,6 +131,10 @@ type OptionalProps<ItemT> = {
* `getItemLayout` to be implemented. * `getItemLayout` to be implemented.
*/ */
initialScrollIndex?: ?number, initialScrollIndex?: ?number,
/**
* Reverses the direction of scroll. Uses scale transforms of -1.
*/
inverted?: ?boolean,
/** /**
* Used to extract a unique key for a given item at the specified index. Key is used for caching * Used to extract a unique key for a given item at the specified index. Key is used for caching
* and as the react key to track item re-ordering. The default extractor checks `item.key`, then * and as the react key to track item re-ordering. The default extractor checks `item.key`, then

View File

@ -124,12 +124,15 @@ type OptionalProps<SectionT: SectionBase<any>> = {
* to improve perceived performance of scroll-to-top actions. * to improve perceived performance of scroll-to-top actions.
*/ */
initialNumToRender: number, initialNumToRender: number,
/**
* Reverses the direction of scroll. Uses scale transforms of -1.
*/
inverted?: ?boolean,
/** /**
* Used to extract a unique key for a given item at the specified index. Key is used for caching * Used to extract a unique key for a given item at the specified index. Key is used for caching
* and as the react key to track item re-ordering. The default extractor checks item.key, then * and as the react key to track item re-ordering. The default extractor checks item.key, then
* falls back to using the index, like react does. * falls back to using the index, like react does.
*/ */
keyExtractor: (item: Item, index: number) => string, keyExtractor: (item: Item, index: number) => string,
/** /**
* Called once when the scroll position gets within `onEndReachedThreshold` of the rendered * Called once when the scroll position gets within `onEndReachedThreshold` of the rendered

View File

@ -19,6 +19,7 @@ const React = require('React');
const ReactNative = require('ReactNative'); const ReactNative = require('ReactNative');
const RefreshControl = require('RefreshControl'); const RefreshControl = require('RefreshControl');
const ScrollView = require('ScrollView'); const ScrollView = require('ScrollView');
const StyleSheet = require('StyleSheet');
const View = require('View'); const View = require('View');
const ViewabilityHelper = require('ViewabilityHelper'); const ViewabilityHelper = require('ViewabilityHelper');
@ -29,6 +30,7 @@ const warning = require('fbjs/lib/warning');
const {computeWindowedRenderLimits} = require('VirtualizeUtils'); const {computeWindowedRenderLimits} = require('VirtualizeUtils');
import type {StyleObj} from 'StyleSheetTypes';
import type {ViewabilityConfig, ViewToken} from 'ViewabilityHelper'; import type {ViewabilityConfig, ViewToken} from 'ViewabilityHelper';
type Item = any; type Item = any;
@ -87,6 +89,10 @@ type OptionalProps = {
* `getItemLayout` to be implemented. * `getItemLayout` to be implemented.
*/ */
initialScrollIndex?: ?number, initialScrollIndex?: ?number,
/**
* Reverses the direction of scroll. Uses scale transforms of -1.
*/
inverted?: ?boolean,
keyExtractor: (item: Item, index: number) => string, keyExtractor: (item: Item, index: number) => string,
/** /**
* Rendered when the list is empty. Can be a React Component Class, a render function, or * Rendered when the list is empty. Can be a React Component Class, a render function, or
@ -424,6 +430,7 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
stickyIndicesFromProps: Set<number>, stickyIndicesFromProps: Set<number>,
first: number, first: number,
last: number, last: number,
inversionStyle: ?StyleObj,
) { ) {
const { const {
ItemSeparatorComponent, ItemSeparatorComponent,
@ -449,6 +456,7 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
cellKey={key} cellKey={key}
fillRateHelper={this._fillRateHelper} fillRateHelper={this._fillRateHelper}
index={ii} index={ii}
inversionStyle={inversionStyle}
item={item} item={item}
key={key} key={key}
prevCellKey={prevCellKey} prevCellKey={prevCellKey}
@ -501,6 +509,11 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
} = this.props; } = this.props;
const {data, horizontal} = this.props; const {data, horizontal} = this.props;
const isVirtualizationDisabled = this._isVirtualizationDisabled(); const isVirtualizationDisabled = this._isVirtualizationDisabled();
const inversionStyle = this.props.inverted
? this.props.horizontal
? styles.horizontallyInverted
: styles.verticallyInverted
: null;
const cells = []; const cells = [];
const stickyIndicesFromProps = new Set(this.props.stickyHeaderIndices); const stickyIndicesFromProps = new Set(this.props.stickyHeaderIndices);
const stickyHeaderIndices = []; const stickyHeaderIndices = [];
@ -509,7 +522,10 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
? ListHeaderComponent // $FlowFixMe ? ListHeaderComponent // $FlowFixMe
: <ListHeaderComponent />; : <ListHeaderComponent />;
cells.push( cells.push(
<View key="$header" onLayout={this._onLayoutHeader}> <View
key="$header"
onLayout={this._onLayoutHeader}
style={inversionStyle}>
{element} {element}
</View>, </View>,
); );
@ -528,6 +544,7 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
stickyIndicesFromProps, stickyIndicesFromProps,
0, 0,
lastInitialIndex, lastInitialIndex,
inversionStyle,
); );
const firstAfterInitial = Math.max(lastInitialIndex + 1, first); const firstAfterInitial = Math.max(lastInitialIndex + 1, first);
if (!isVirtualizationDisabled && first > lastInitialIndex + 1) { if (!isVirtualizationDisabled && first > lastInitialIndex + 1) {
@ -550,6 +567,7 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
stickyIndicesFromProps, stickyIndicesFromProps,
ii, ii,
ii, ii,
inversionStyle,
); );
const trailSpace = const trailSpace =
this._getFrameMetricsApprox(first).offset - this._getFrameMetricsApprox(first).offset -
@ -578,6 +596,7 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
stickyIndicesFromProps, stickyIndicesFromProps,
firstAfterInitial, firstAfterInitial,
last, last,
inversionStyle,
); );
if (!this._hasWarned.keys && _usedIndexForKey) { if (!this._hasWarned.keys && _usedIndexForKey) {
console.warn( console.warn(
@ -608,7 +627,10 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
? ListEmptyComponent // $FlowFixMe ? ListEmptyComponent // $FlowFixMe
: <ListEmptyComponent />; : <ListEmptyComponent />;
cells.push( cells.push(
<View key="$empty" onLayout={this._onLayoutEmpty}> <View
key="$empty"
onLayout={this._onLayoutEmpty}
style={inversionStyle}>
{element} {element}
</View>, </View>,
); );
@ -618,7 +640,10 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
? ListFooterComponent // $FlowFixMe ? ListFooterComponent // $FlowFixMe
: <ListFooterComponent />; : <ListFooterComponent />;
cells.push( cells.push(
<View key="$footer" onLayout={this._onLayoutFooter}> <View
key="$footer"
onLayout={this._onLayoutFooter}
style={inversionStyle}>
{element} {element}
</View>, </View>,
); );
@ -634,6 +659,9 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
scrollEventThrottle: this.props.scrollEventThrottle, // TODO: Android support scrollEventThrottle: this.props.scrollEventThrottle, // TODO: Android support
stickyHeaderIndices, stickyHeaderIndices,
}; };
if (inversionStyle) {
scrollProps.style = [inversionStyle, this.props.style];
}
const ret = React.cloneElement( const ret = React.cloneElement(
(this.props.renderScrollComponent || this._defaultRenderScrollComponent)( (this.props.renderScrollComponent || this._defaultRenderScrollComponent)(
scrollProps, scrollProps,
@ -1086,6 +1114,7 @@ class CellRenderer extends React.Component {
cellKey: string, cellKey: string,
fillRateHelper: FillRateHelper, fillRateHelper: FillRateHelper,
index: number, index: number,
inversionStyle: ?StyleObj,
item: Item, item: Item,
onLayout: (event: Object) => void, // This is extracted by ScrollViewStickyHeader onLayout: (event: Object) => void, // This is extracted by ScrollViewStickyHeader
onUnmount: (cellKey: string) => void, onUnmount: (cellKey: string) => void,
@ -1144,6 +1173,7 @@ class CellRenderer extends React.Component {
fillRateHelper, fillRateHelper,
item, item,
index, index,
inversionStyle,
parentProps, parentProps,
} = this.props; } = this.props;
const {renderItem, getItemLayout} = parentProps; const {renderItem, getItemLayout} = parentProps;
@ -1161,7 +1191,7 @@ class CellRenderer extends React.Component {
// NOTE: that when this is a sticky header, `onLayout` will get automatically extracted and // NOTE: that when this is a sticky header, `onLayout` will get automatically extracted and
// called explicitly by `ScrollViewStickyHeader`. // called explicitly by `ScrollViewStickyHeader`.
return ( return (
<View onLayout={onLayout}> <View onLayout={onLayout} style={inversionStyle}>
{element} {element}
{ItemSeparatorComponent && {ItemSeparatorComponent &&
<ItemSeparatorComponent {...this.state.separatorProps} />} <ItemSeparatorComponent {...this.state.separatorProps} />}
@ -1170,4 +1200,13 @@ class CellRenderer extends React.Component {
} }
} }
const styles = StyleSheet.create({
verticallyInverted: {
transform: [{scaleY: -1}],
},
horizontallyInverted: {
transform: [{scaleX: -1}],
},
});
module.exports = VirtualizedList; module.exports = VirtualizedList;

View File

@ -93,10 +93,11 @@ describe('VirtualizedList', () => {
data={new Array(5).fill().map((_, ii) => ({id: String(ii)}))} data={new Array(5).fill().map((_, ii) => ({id: String(ii)}))}
getItem={(data, index) => data[index]} getItem={(data, index) => data[index]}
getItemCount={data => data.length} getItemCount={data => data.length}
keyExtractor={(item, index) => item.id}
getItemLayout={({index}) => ({length: 50, offset: index * 50})} getItemLayout={({index}) => ({length: 50, offset: index * 50})}
refreshing={false} inverted={true}
keyExtractor={(item, index) => item.id}
onRefresh={jest.fn()} onRefresh={jest.fn()}
refreshing={false}
renderItem={({item}) => <item value={item.id} />} renderItem={({item}) => <item value={item.id} />}
/>, />,
); );

View File

@ -61,11 +61,13 @@ exports[`FlatList renders all the bells and whistles 1`] = `
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<header /> <header />
</View> </View>
<View <View
onLayout={undefined} onLayout={undefined}
style={null}
> >
<View <View
style={ style={
@ -88,6 +90,7 @@ exports[`FlatList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={undefined} onLayout={undefined}
style={null}
> >
<View <View
style={ style={
@ -110,6 +113,7 @@ exports[`FlatList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={undefined} onLayout={undefined}
style={null}
> >
<View <View
style={ style={
@ -128,6 +132,7 @@ exports[`FlatList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<footer /> <footer />
</View> </View>
@ -233,6 +238,7 @@ exports[`FlatList renders simple list 1`] = `
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
value="i1" value="i1"
@ -240,6 +246,7 @@ exports[`FlatList renders simple list 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
value="i2" value="i2"
@ -247,6 +254,7 @@ exports[`FlatList renders simple list 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
value="i3" value="i3"

View File

@ -63,9 +63,11 @@ exports[`SectionList rendering empty section headers is fine 1`] = `
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
/> />
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
v="i1" v="i1"
@ -73,6 +75,7 @@ exports[`SectionList rendering empty section headers is fine 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
v="i2" v="i2"
@ -80,6 +83,7 @@ exports[`SectionList rendering empty section headers is fine 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
/> />
</View> </View>
</RCTScrollView> </RCTScrollView>
@ -135,6 +139,7 @@ exports[`SectionList renders a footer when there is no data 1`] = `
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<sectionHeader <sectionHeader
v="section:s1" v="section:s1"
@ -142,6 +147,7 @@ exports[`SectionList renders a footer when there is no data 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<sectionFooter <sectionFooter
v="section:s1" v="section:s1"
@ -200,9 +206,11 @@ exports[`SectionList renders a footer when there is no data and no header 1`] =
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
/> />
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<sectionFooter <sectionFooter
v="section:s1" v="section:s1"
@ -342,6 +350,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<header <header
v="" v=""
@ -349,6 +358,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<sectionHeader <sectionHeader
v="section:s1" v="section:s1"
@ -356,6 +366,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<View> <View>
<sectionSeparator <sectionSeparator
@ -371,6 +382,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<View> <View>
<itemForSection1 <itemForSection1
@ -383,6 +395,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<sectionFooter <sectionFooter
v="section:s1" v="section:s1"
@ -390,6 +403,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<sectionHeader <sectionHeader
v="section:s2" v="section:s2"
@ -397,6 +411,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<View> <View>
<sectionSeparator <sectionSeparator
@ -412,6 +427,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<View> <View>
<defaultItem <defaultItem
@ -424,6 +440,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<sectionFooter <sectionFooter
v="section:s2" v="section:s2"
@ -431,6 +448,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<sectionHeader <sectionHeader
v="section:s3" v="section:s3"
@ -438,6 +456,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<View> <View>
<sectionSeparator <sectionSeparator
@ -453,6 +472,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<View> <View>
<defaultItem <defaultItem
@ -465,6 +485,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<sectionFooter <sectionFooter
v="section:s3" v="section:s3"
@ -472,6 +493,7 @@ exports[`SectionList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<footer <footer
v="" v=""

View File

@ -35,6 +35,7 @@ exports[`VirtualizedList handles nested lists 1`] = `
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<View <View
data={ data={
@ -69,6 +70,7 @@ exports[`VirtualizedList handles nested lists 1`] = `
> >
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
title="outer0:inner0" title="outer0:inner0"
@ -76,6 +78,7 @@ exports[`VirtualizedList handles nested lists 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
title="outer0:inner1" title="outer0:inner1"
@ -85,6 +88,7 @@ exports[`VirtualizedList handles nested lists 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<RCTScrollView <RCTScrollView
data={ data={
@ -120,6 +124,7 @@ exports[`VirtualizedList handles nested lists 1`] = `
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
title="outer1:inner0" title="outer1:inner0"
@ -127,6 +132,7 @@ exports[`VirtualizedList handles nested lists 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
title="outer1:inner1" title="outer1:inner1"
@ -178,6 +184,7 @@ exports[`VirtualizedList handles separators correctly 1`] = `
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
title="i0" title="i0"
@ -193,6 +200,7 @@ exports[`VirtualizedList handles separators correctly 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
title="i1" title="i1"
@ -208,6 +216,7 @@ exports[`VirtualizedList handles separators correctly 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
title="i2" title="i2"
@ -256,6 +265,7 @@ exports[`VirtualizedList handles separators correctly 2`] = `
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
title="i0" title="i0"
@ -271,6 +281,7 @@ exports[`VirtualizedList handles separators correctly 2`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
title="i1" title="i1"
@ -286,6 +297,7 @@ exports[`VirtualizedList handles separators correctly 2`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
title="i2" title="i2"
@ -334,6 +346,7 @@ exports[`VirtualizedList handles separators correctly 3`] = `
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
title="i0" title="i0"
@ -349,6 +362,7 @@ exports[`VirtualizedList handles separators correctly 3`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
title="i1" title="i1"
@ -365,6 +379,7 @@ exports[`VirtualizedList handles separators correctly 3`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
title="i2" title="i2"
@ -405,6 +420,7 @@ exports[`VirtualizedList renders all the bells and whistles 1`] = `
getItemLayout={[Function]} getItemLayout={[Function]}
horizontal={false} horizontal={false}
initialNumToRender={10} initialNumToRender={10}
inverted={true}
keyExtractor={[Function]} keyExtractor={[Function]}
maxToRenderPerBatch={10} maxToRenderPerBatch={10}
onContentSizeChange={[Function]} onContentSizeChange={[Function]}
@ -426,6 +442,18 @@ exports[`VirtualizedList renders all the bells and whistles 1`] = `
renderItem={[Function]} renderItem={[Function]}
scrollEventThrottle={50} scrollEventThrottle={50}
stickyHeaderIndices={Array []} stickyHeaderIndices={Array []}
style={
Array [
Object {
"transform": Array [
Object {
"scaleY": -1,
},
],
},
undefined,
]
}
updateCellsBatchingPeriod={50} updateCellsBatchingPeriod={50}
windowSize={21} windowSize={21}
> >
@ -433,11 +461,29 @@ exports[`VirtualizedList renders all the bells and whistles 1`] = `
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={
Object {
"transform": Array [
Object {
"scaleY": -1,
},
],
}
}
> >
<header /> <header />
</View> </View>
<View <View
onLayout={undefined} onLayout={undefined}
style={
Object {
"transform": Array [
Object {
"scaleY": -1,
},
],
}
}
> >
<item <item
value="0" value="0"
@ -446,6 +492,15 @@ exports[`VirtualizedList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={undefined} onLayout={undefined}
style={
Object {
"transform": Array [
Object {
"scaleY": -1,
},
],
}
}
> >
<item <item
value="1" value="1"
@ -454,6 +509,15 @@ exports[`VirtualizedList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={undefined} onLayout={undefined}
style={
Object {
"transform": Array [
Object {
"scaleY": -1,
},
],
}
}
> >
<item <item
value="2" value="2"
@ -462,6 +526,15 @@ exports[`VirtualizedList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={undefined} onLayout={undefined}
style={
Object {
"transform": Array [
Object {
"scaleY": -1,
},
],
}
}
> >
<item <item
value="3" value="3"
@ -470,6 +543,15 @@ exports[`VirtualizedList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={undefined} onLayout={undefined}
style={
Object {
"transform": Array [
Object {
"scaleY": -1,
},
],
}
}
> >
<item <item
value="4" value="4"
@ -477,6 +559,15 @@ exports[`VirtualizedList renders all the bells and whistles 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={
Object {
"transform": Array [
Object {
"scaleY": -1,
},
],
}
}
> >
<footer /> <footer />
</View> </View>
@ -540,16 +631,19 @@ exports[`VirtualizedList renders empty list with empty component 1`] = `
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<header /> <header />
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<empty /> <empty />
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<footer /> <footer />
</View> </View>
@ -590,6 +684,7 @@ exports[`VirtualizedList renders list with empty component 1`] = `
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
value="hello" value="hello"
@ -664,6 +759,7 @@ exports[`VirtualizedList renders simple list 1`] = `
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
value="i1" value="i1"
@ -671,6 +767,7 @@ exports[`VirtualizedList renders simple list 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
value="i2" value="i2"
@ -678,6 +775,7 @@ exports[`VirtualizedList renders simple list 1`] = `
</View> </View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
value="i3" value="i3"
@ -719,6 +817,7 @@ exports[`VirtualizedList test getItem functionality where data is not an Array 1
<View> <View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={null}
> >
<item <item
value="item_0" value="item_0"

View File

@ -55,6 +55,7 @@ class FlatListExample extends React.PureComponent {
data: genItemData(100), data: genItemData(100),
debug: false, debug: false,
horizontal: false, horizontal: false,
inverted: false,
filterText: '', filterText: '',
fixedHeight: true, fixedHeight: true,
logViewable: false, logViewable: false,
@ -111,6 +112,7 @@ class FlatListExample extends React.PureComponent {
{renderSmallSwitchOption(this, 'horizontal')} {renderSmallSwitchOption(this, 'horizontal')}
{renderSmallSwitchOption(this, 'fixedHeight')} {renderSmallSwitchOption(this, 'fixedHeight')}
{renderSmallSwitchOption(this, 'logViewable')} {renderSmallSwitchOption(this, 'logViewable')}
{renderSmallSwitchOption(this, 'inverted')}
{renderSmallSwitchOption(this, 'debug')} {renderSmallSwitchOption(this, 'debug')}
<Spindicator value={this._scrollPos} /> <Spindicator value={this._scrollPos} />
</View> </View>
@ -128,6 +130,7 @@ class FlatListExample extends React.PureComponent {
undefined undefined
} }
horizontal={this.state.horizontal} horizontal={this.state.horizontal}
inverted={this.state.inverted}
key={(this.state.horizontal ? 'h' : 'v') + key={(this.state.horizontal ? 'h' : 'v') +
(this.state.fixedHeight ? 'f' : 'd') (this.state.fixedHeight ? 'f' : 'd')
} }