Giter VIP home page Giter VIP logo

Comments (16)

vvmgev avatar vvmgev commented on July 26, 2024 1

with redux
when i use methods of life cycle and in the method I do dispatch
example like this
this.props.setImages([], 0)
i get this error
ExceptionsManager.js:65 TypeError: Cannot read property 'reLayoutFromIndex' of undefined

from recyclerlistview.

sm2017 avatar sm2017 commented on July 26, 2024 1

I have just a mistake , actually this code works well

const mapStateToProps = state => {
  return {
    dataProvider: new DataProvider((r1, r2) => {
      return r1 !== r2
    }).cloneWithRows(state)
  }
}

from recyclerlistview.

sm2017 avatar sm2017 commented on July 26, 2024

I put a log at rowHasChanged of dataProvider

(r1, r2) => {
  console.log('r1, r2',r1, r2,r1 !== r2);
  return r1 !== r2;
}

I understand that always r1 and r2 is repeated to and r1 !== r2 is always false , I change rowHasChanged to (r1, r2) => {return true} just for testing , but not solved

from recyclerlistview.

naqvitalha avatar naqvitalha commented on July 26, 2024

Only keep data in Redux store and create DataProvider inside the component that renders RecyclerListView. When data changes simply create a new one. Don't have it inside the store, that will solve it.
If this doesn't help it would be simpler if you can repro the issue on snack so that I can take a look. Here @Flipkart we already use RecyclerListView with Redux.

from recyclerlistview.

sm2017 avatar sm2017 commented on July 26, 2024

@naqvitalha DataProvider is not in store and is in connect , I tried inside component too , But not working
I will provide simple repro within an hour

from recyclerlistview.

sm2017 avatar sm2017 commented on July 26, 2024

Please clone and run this https://github.com/sm2017/issue-68

In this line https://github.com/sm2017/issue-68/blob/master/src/App.js#L7 , I just put data as initial sate , we never ever change state in this example

https://github.com/sm2017/issue-68/blob/master/src/flights/FlightsPage.js#L90-L98 I add dataProvider to props and if state change new dataProvider is created

As you can see https://github.com/sm2017/issue-68/blob/master/src/flights/FlightData.js#L13 we have only one Green_circle Icon , But if you scroll down , you can see duplicated

Green_circle

from recyclerlistview.

sm2017 avatar sm2017 commented on July 26, 2024

@naqvitalha I see that https://github.com/naqvitalha/travelMate without redux has same issue , Please run https://github.com/naqvitalha/travelMate when you change FlighData with Green_circle Icon

from recyclerlistview.

vvmgev avatar vvmgev commented on July 26, 2024

in the example if you use this methods yo can see that error

       componentDidMount() {
        this.setState({
            dataProvider: this.dataProvider.cloneWithRows(this._generateArray(3))
        })
    }

if you use it with setTimeout
its working

    componentDidMount() {
        setTimeout(() => {
            this.setState({
                dataProvider: this.dataProvider.cloneWithRows(this._generateArray(3))
            })
        },2000)
       
    }

from recyclerlistview.

naqvitalha avatar naqvitalha commented on July 26, 2024

@vvmgev Try version 1.2.0-beta.4 ... Should be fine. But know that version is under testing right now.
@sm2017 I'm looking into your issue. Will get back.

from recyclerlistview.

naqvitalha avatar naqvitalha commented on July 26, 2024

@sm2017 I checked the travelMate code, if you look at the bottom I'm using concat to make list longer. This will duplicate object references and cause the issue. I've fixed it can you try and repro now?

from recyclerlistview.

vvmgev avatar vvmgev commented on July 26, 2024

@naqvitalha ok thanks I will use it
and I have a small question
Now I can set the scroll position when initializing, like scrollTo function

from recyclerlistview.

naqvitalha avatar naqvitalha commented on July 26, 2024

@vvmgev Use initialRenderOffset or initialRenderIndex while mounting. Make sure you don't mount with empty data to fully leverage it.

from recyclerlistview.

vvmgev avatar vvmgev commented on July 26, 2024

@naqvitalha thanks

from recyclerlistview.

sm2017 avatar sm2017 commented on July 26, 2024

@naqvitalha My problem is solved , I can use Redux without issue

from recyclerlistview.

naqvitalha avatar naqvitalha commented on July 26, 2024

@sm2017 can you let us know your findings so that it may help others with similar issue.

from recyclerlistview.

naqvitalha avatar naqvitalha commented on July 26, 2024

Great.

from recyclerlistview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.