How to use the recyclerlistview.LayoutProvider function in recyclerlistview

To help you get started, we’ve selected a few recyclerlistview examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rainbow-me / rainbow / src / components / change-wallet / ProfileList.js View on Github external
constructor(args) {
    super(args);

    this.state = {
      profiles: [],
    };

    this._layoutProvider = new LayoutProvider((i) => {
      if (this.props.allAssets && i < this.props.allAssets.length) {
        return WALLET_ROW;
      }
      return WALLET_LAST_ROW;
    }, (type, dim) => {
      if (type === WALLET_ROW) {
        dim.width = deviceUtils.dimensions.width;
        dim.height = rowHeight;
      } else if (type === WALLET_LAST_ROW) {
        dim.width = deviceUtils.dimensions.width;
        dim.height = rowHeight + lastRowPadding;
      } else {
        dim.width = 0;
        dim.height = 0;
      }
    });
github rainbow-me / rainbow / src / components / asset-list / RecyclerAssetList.js View on Github external
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;
        }

        const balancesIndex = findIndex(
          sections,
          ({ name }) => name === 'balances'
        );
github rainbow-me / rainbow / src / components / activity-list / RecyclerActivityList.js View on Github external
constructor(args) {
    super(args);

    this.state = {
      dataProvider: new DataProvider(hasRowChanged, this.getStableId),
      headersIndices: [],
    };

    this.layoutProvider = new LayoutProvider(
      index => {
        if (index === 0) {
          return ViewTypes.COMPONENT_HEADER;
        }

        if (this.state.headersIndices.includes(index)) {
          return ViewTypes.HEADER;
        }

        if (this.state.headersIndices.includes(index + 1)) {
          return ViewTypes.FOOTER;
        }

        return ViewTypes.ROW;
      },
      (type, dim) => {
github jpush / aurora-imui / ReactNative_JS / MessageList.js View on Github external
constructor(props) {
    super(props)
    this.state = {
        dataProvider: new DataProvider((r1, r2) => {
          return r1 !== r2
        }, (index) => {
          return this.props.messageList[index].values.msgId
        }).cloneWithRows(props.messageList),
        refreshing: false
    }
    
    this._layoutProvider = new LayoutProvider((i) => {
        return this.state.dataProvider.getDataForIndex(i).type
    }, (type, dim, index) => {
        dim.height = 300
        dim.width = width
    })
    
    this._renderRow = this._renderRow.bind(this)
    this.scrollToIndex = this.scrollToIndex.bind(this)
  }
github sskhandek / react-native-emoji-input / example / src / EmojiInput.js View on Github external
this.emoji = [];

        this.loggingFunction = this.props.loggingFunction
            ? this.props.loggingFunction
            : null;

        this.verboseLoggingFunction = this.props.verboseLoggingFunction
            ? this.props.verboseLoggingFunction
            : false;

        let dataProvider = new DataProvider((e1, e2) => {
            return e1.char !== e2.char;
        });

        this._layoutProvider = new LayoutProvider(
            index =>
                _.has(this.emoji[index], 'categoryMarker')
                    ? ViewTypes.CATEGORY
                    : ViewTypes.EMOJI,
            (type, dim) => {
                switch (type) {
                    case ViewTypes.CATEGORY:
                        dim.height = this.props.categoryLabelHeight;
                        dim.width = props.width;
                        break;
                    case ViewTypes.EMOJI:
                        dim.height = dim.width = this.emojiSize;
                        break;
                }
            }
        );
github sskhandek / react-native-emoji-input / src / EmojiInput.js View on Github external
this.emoji = [];

        this.loggingFunction = this.props.loggingFunction
            ? this.props.loggingFunction
            : null;

        this.verboseLoggingFunction = this.props.verboseLoggingFunction
            ? this.props.verboseLoggingFunction
            : false;

        let dataProvider = new DataProvider((e1, e2) => {
            return e1.char !== e2.char;
        });

        this._layoutProvider = new LayoutProvider(
            index =>
                _.has(this.emoji[index], 'categoryMarker')
                    ? ViewTypes.CATEGORY
                    : ViewTypes.EMOJI,
            (type, dim) => {
                switch (type) {
                    case ViewTypes.CATEGORY:
                        dim.height = this.props.categoryLabelHeight;
                        dim.width = props.width;
                        break;
                    case ViewTypes.EMOJI:
                        dim.height = dim.width = this.emojiSize;
                        break;
                }
            }
        );
github rainbow-me / rainbow / src / components / avatar-builder / EmojiSelector.js View on Github external
this.state = {
      allEmojiList: [],
      category: Categories.people,
      colSize: 0,
      emojiList: [],
      history: [],
      isReady: false,
      searchQuery: '',
    };

    this.recentlyRendered = false;
    this.touchedContact = undefined;
    this.contacts = {};

    this._layoutProvider = new LayoutProvider(
      i => {
        if (i == 0 || i == this.state.allEmojiList.length - 1) {
          return OVERLAY;
        }
        if (i % 2 == 0) {
          return EMOJI_CONTAINER;
        }
        return HEADER_ROW;
      },
      (type, dim, i) => {
        if (type === EMOJI_CONTAINER) {
          dim.height =
            Math.floor(this.state.allEmojiList[i].data.length / 7 + 1) *
            ((width - 21) / this.props.columns);
          dim.width = deviceUtils.dimensions.width;
        } else if (type === HEADER_ROW) {
github SocialXNetwork / socialx_react_native / packages / RNSocialX / src / components / displayers / PhotoGrid.tsx View on Github external
const getGridProvider = (itemWidth: number, itemHeight: number) => {
	if (!layoutProvider) {
		layoutProvider = new LayoutProvider(
			() => ViewTypes.ITEM_LAYOUT,
			(type: number | string, dim: { width: number; height: number }) => {
				dim.width = itemWidth;
				dim.height = itemHeight;
			},
		);
	}

	return layoutProvider;
};
github naqvitalha / recyclerlistview-context-preservation-demo / contextProviderSampleApp / src / MainComponent.js View on Github external
constructor(props) {
        super(props);

        //Generating data
        this._generateData();

        //Layout provider for parent list
        this._parentRLVLayoutProvider = new LayoutProvider(
            index => {
                return ViewTypes.SIMPLE_ROW;
            },
            (type, dim) => {
                dim.height = 100;
                dim.width = width;
            }
        );

        //Layout provider for children lists
        this._childRLVLayoutProvider = new LayoutProvider(
            index => {
                return ViewTypes.SIMPLE_ROW;
            },
            (type, dim) => {
                dim.height = 100;
github rainbow-me / rainbow / src / components / activity-list / RecyclerActivityList.js View on Github external
constructor(args) {
    super(args);

    this.state = {
      dataProvider: new DataProvider(hasRowChanged, this.getStableId),
      headersIndices: [],
    };

    this.layoutProvider = new LayoutProvider(
      index => {
        if (index === 0) {
          return ViewTypes.COMPONENT_HEADER;
        }

        if (this.state.headersIndices.includes(index)) {
          return ViewTypes.HEADER;
        }

        if (this.state.headersIndices.includes(index + 1)) {
          return ViewTypes.FOOTER;
        }

        return ViewTypes.ROW;
      },
      (type, dim) => {

recyclerlistview

The listview that you need and deserve. It was built for performance, uses cell recycling to achieve smooth scrolling.

Apache-2.0
Latest version published 17 days ago

Package Health Score

89 / 100
Full package analysis