Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React, { Component } from 'react';
import { FixedSizeList, shouldComponentUpdate } from 'react-window';
import CodeBlock from '../../components/CodeBlock';
import ProfiledExample from '../../components/ProfiledExample';
import CODE_HORIZONTAL from '../../code/FixedSizeListHorizontal.js';
import CODE_VERTICAL from '../../code/FixedSizeListVertical.js';
import styles from './shared.module.css';
class Item extends Component {
// Ignore changes in style wrapper Object.
shouldComponentUpdate = shouldComponentUpdate.bind(this);
render() {
const { data, index, style } = this.props;
return (
<div style="{style}">
{data} {index}
</div>
);
}
}
export default function() {
//console.log('Inside MenuList:');
var _props = this.props,
options = _props.options,
children = _props.children,
maxHeight = _props.maxHeight,
getValue = _props.getValue;
var _getValue = getValue(),
_getValue2 = _slicedToArray(_getValue, 1),
value = _getValue2[0];
var initialOffset = options.indexOf(value) * height;
return _react2.default.createElement(
_reactWindow.FixedSizeList,
{
height: maxHeight,
itemCount: children.length,
itemSize: 50,
initialScrollOffset: initialOffset },
function (_ref) {
var index = _ref.index,
style = _ref.style;
return _react2.default.createElement(
"div",
{ style: style },
children[index]
);
}
);
}
);
}
}
class PageRow extends Component {
static propTypes = {
index: number,
style: shape(),
data: shape({
scale: number,
searchText: string,
customTextRenderer: func
})
};
shouldComponentUpdate = shouldComponentUpdate.bind(this);
render() {
const { index, style, data } = this.props;
const { scale, customTextRenderer, searchText } = data;
const key = customTextRenderer
? `custom_${searchText}`
: `default_${index}`;
return (
<div style="{style}">
</div>