expo / react-native-invertible-scroll-view

An invertible ScrollView for React Native
MIT License
464 stars 86 forks source link

Opens Bottom Problem #52

Closed ozican closed 6 years ago

ozican commented 6 years ago

Hello everyone. My app start in feed, i reversed with react-native-invertible-scroll-view. But it starts bottom like whatsapp but I want to it starts on top like facebook homepage. Please help me!

  createDataSource({ studentsArray }) {
    const ds = new ListView.DataSource({
      rowHasChanged: (r1, r2) => r1 !== r2
    });
    this.dataSource = ds.cloneWithRows(studentsArray);
  }
  renderRow(ogrenci) {
      return <ListItem ogrenci={ogrenci} />;
    }
   </View>
           <ListView
            renderScrollComponent={props => <InvertibleScrollView {...props} inverted />}
             enableEmptySections
             dataSource={this.dataSource}
             renderRow={this.renderRow}
           />
        </View>
LouisJS commented 6 years ago

Could you provide a Snack from expo.io and details a bit more your issue. From what i understand, you want a simple ListView.. which is not the point of this project

ozican commented 6 years ago

Hello, It is simple. I have a ListView and it lists items from firebase's database. My problem was, when i add new item to firebase, it sending in ListView's bottom... I wanted to newest come to top.. And then for this reason I install react-native-invertible-scroll-view. Now newest on the top of ListView but now the problem is, screen starts ListView's bottom, when i open my app i have to scroll to top for see the new item.

LouisJS commented 6 years ago

So you don't need react-native-invertible-scroll-view. It is not about the layout, it is about your data. You need to reverse the order of your data array.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse

ozican commented 6 years ago

yes but I can not order in react native. If there is a example i want to see... I try lots of way but I couldn't be success.

ozican commented 6 years ago

hey it worked!!! You are amazing man!!

  createDataSource({ studentsArray }) {
    const ds = new ListView.DataSource({
      rowHasChanged: (r1, r2) => r1 !== r2
    });
    this.dataSource = ds.cloneWithRows(studentsArray.reverse());
  }