Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentWillMount() {
const dataProvider = new DataProvider((rowA, rowB) => {
// If the rows are the same
// Then we check if the data within them is different
if (rowA.id === rowB.id) {
return !isEqual(rowA, rowB);
}
// Rows are different
return true;
}).cloneWithRows(this.props.libraryEntries.slice());
this.setState({ dataProvider });
// Only one type of row item
this.layoutProvider = new LayoutProvider(() => LAYOUT_PROVIDER_TYPE, (type, dim, index) => {
switch (type) {
case LAYOUT_PROVIDER_TYPE: {
dim.width = LAYOUT_WIDTH;
'Raspberries',
'Strawberries',
'Tomato',
'Ugni',
'Vanilla Bean',
'Watermelon',
'Ximenia caffra fruit',
'Yellow Passion Fruit',
'Zuchinni'
];
//Every list in parent has its own data provider and context provider which we create here, to know more about this
//check samples of RecyclerListView
for (let i = 0; i < this._parentArr.length; i++) {
this._parentArr[i] = {
dataProvider: new DataProvider((r1, r2) => {
return r1 !== r2;
}).cloneWithRows(this._childArr),
//Proving unique key to context provider, using index as unique key here. You can choose your own, this should be
//unique in global scope ideally.
contextProvider: new ContextHelper(i + '')
};
}
}
render = () => (
{this.state.contacts.length === 0 ? (
) : (
)}
);
}
//Layout provider for children lists
this._childRLVLayoutProvider = new LayoutProvider(
index => {
return ViewTypes.SIMPLE_ROW;
},
(type, dim) => {
dim.height = 100;
dim.width = 100;
}
);
this._parentContextProvider = new ContextHelper('PARENT');
this.state = {
isViewMounted: true,
parentRLVDataProvider: new DataProvider((r1, r2) => {
return r1 !== r2;
}).cloneWithRows(this._parentArr)
};
}
emojiRenderer = emojis => {
let dataProvider = new DataProvider((e1, e2) => {
return e1.char !== e2.char;
});
this.emoji = [];
let categoryIndexMap = _(category)
.map((v, idx) => ({ ...v, idx }))
.keyBy('key')
.value();
let tempEmoji = _
.range(_.size(category))
.map((v, k) => [
{ char: category[k].key, categoryMarker: true, ...category[k] }
]);
_(emojis)
.values()
asset: [],
isCurrentProfile: true,
onCloseModal: (editedProfile) => onCloseEditProfileModal(editedProfile),
profile: currentProfile,
type: 'profile_creator',
})}
onTouch={this.closeAllDifferentContacts}
onTransitionEnd={this.changeCurrentlyUsedContact}
isInitializationOver={isInitializationOver}
/>}
{showSearchBar && Searchbar}
{!isReady && (
)}
{showTabs && (
constructor(args) {
super(args);
let { width } = Dimensions.get("window");
//Create the data provider and provide method which takes in two rows of data and return if those two are different or not.
let dataProvider = new DataProvider((r1, r2) => {
return r1 !== r2;
});
//Create the layout provider
//First method: Given an index return the type of item e.g ListItemType1, ListItemType2 in case you have variety of items in your list/grid
//Second: Given a type and object set the height and width for that type on given object
//If you need data based check you can access your data provider here
//You'll need data in most cases, we don't provide it by default to enable things like data virtualization in the future
//NOTE: For complex lists LayoutProvider will also be complex it would then make sense to move it to a different file
this._layoutProvider = new LayoutProvider(
index => {
if (index % 3 === 0) {
return ViewTypes.FULL;
} else if (index % 3 === 1) {
return ViewTypes.HALF_LEFT;
} else {
constructor(props) {
super(props);
this.state = {
dataProvider: new DataProvider(hasRowChanged, this.getStableId),
headersIndices: [],
isRefreshing: false,
itemsCount: 0,
};
this.layoutProvider = new LayoutProvider(
index => {
const { openFamilyTabs, openInvestmentCards, sections } = this.props;
const { headersIndices } = this.state;
if (headersIndices.includes(index)) {
return ViewTypes.HEADER;
}
if (index === this.state.itemsCount - 1) {
return ViewTypes.FOOTER;