Skip to content

[Bug][FlatList] assigning object to viewabilityConfig prop in render method triggers error #16710

@eballeste

Description

@eballeste

Is this a bug report?

Yup.

Have you read the Contributing Guidelines?

Yup.

Environment

OS: OS X El Capitan 10.11.6
Node: 7.10.0
Yarn: 0.24.6
npm: 4.2.0
Watchman: 4.9.0
Xcode: Xcode 8.2.1 Build version 8C1002
Android Studio: Not Found

Packages: (wanted => installed)
react: 16.0.0 => 16.0.0
react-native: 0.50.1 => 0.50.1

Steps to Reproduce

Use a flatlist with a viewabilityConfig.viewAreaCoveragePercentThreshold prop set to any value.
e.g: viewabilityConfig={{ viewAreaCoveragePercentThreshold: 50 }}.

<View>
    <FlatList
      data={[{a: foo}, {b: bar}, {c: foobar}]}
      viewabilityConfig={{ viewAreaCoveragePercentThreshold: 50 }}
    />
</View>

Expected Behavior

Normal use of a viewabilityConfig prop on a FlatList.

Actual Behavior

Use of viewabilityConfig throws errors caused by checks introduced in the following commit: ad733ad

Get Invariant violations, testing for equality, console.log spits out equal values, throws error regardless.

FlatList.js (425-428):

invariant(
      nextProps.viewabilityConfig === this.props.viewabilityConfig,
      'Changing viewabilityConfig on the fly is not supported',
);

screen shot 2017-11-06 at 7 25 35 pm

Reproducible Demo

Can't reproduce error on snack.

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions