iskugor / Ti.SwipeRefreshLayout

Titanium module for Android's SwipeRefreshLayout.
56 stars 19 forks source link

Can't scroll back up on ListView without triggering refresh #15

Closed jennaharris7 closed 8 years ago

jennaharris7 commented 9 years ago

When using a listview, if a user scrolls down the list, and then attempts to scroll back up, the refresh action is initiated again immediately

ghost commented 9 years ago

@jennaharris7 In which version of android are you seeing this issue, because I cannot recreate it with a simple example like this on android 5.1

var swiperefreshlayout = require('com.rkam.swiperefreshlayout');
var listView = Ti.UI.createListView();
var sections = [];

var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits'});
var fruitDataSet = [
    {properties: { title: 'Apple'}},
    {properties: { title: 'Banana'}},
    {properties: { title: 'Apple'}},
    {properties: { title: 'Banana'}},
    {properties: { title: 'Apple'}},
    {properties: { title: 'Banana'}},
    {properties: { title: 'Apple'}},
    {properties: { title: 'Banana'}},
    {properties: { title: 'Apple'}},
    {properties: { title: 'Banana'}},
    {properties: { title: 'Apple'}},
    {properties: { title: 'Banana'}}
];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);

var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables'});
var vegDataSet = [
    {properties: { title: 'Carrots'}},
    {properties: { title: 'Potatoes'}},
    {properties: { title: 'Carrots'}},
    {properties: { title: 'Potatoes'}},
    {properties: { title: 'Carrots'}},
    {properties: { title: 'Potatoes'}},
    {properties: { title: 'Carrots'}},
    {properties: { title: 'Potatoes'}},
    {properties: { title: 'Carrots'}},
    {properties: { title: 'Potatoes'}},
    {properties: { title: 'Carrots'}},
    {properties: { title: 'Potatoes'}}
];
vegSection.setItems(vegDataSet);
sections.push(vegSection);

listView.sections = sections;

var fishSection = Ti.UI.createListSection({ headerTitle: 'Fish'});
var fishDataSet = [
    {properties: { title: 'Cod'}},
    {properties: { title: 'Haddock'}},
    {properties: { title: 'Cod'}},
    {properties: { title: 'Haddock'}},
    {properties: { title: 'Cod'}},
    {properties: { title: 'Haddock'}},
    {properties: { title: 'Cod'}},
    {properties: { title: 'Haddock'}},
    {properties: { title: 'Cod'}},
    {properties: { title: 'Haddock'}},
    {properties: { title: 'Cod'}},
    {properties: { title: 'Haddock'}},
    {properties: { title: 'Cod'}},
    {properties: { title: 'Haddock'}}
];
fishSection.setItems(fishDataSet);
listView.appendSection(fishSection);
var swipeRefresh = swiperefreshlayout.createSwipeRefresh({
    view: listView,
    height: Ti.UI.FILL,
    width: Ti.UI.FILL
});
win.add(swipeRefresh);
ilker55 commented 8 years ago

I'm having the same issue. I have a home.js which creates a scrollableview. And one of the views is search.js which has a listview made in alloy.

home.js:

Ti.App.tabGroup = Ti.UI.createScrollableView({
    views: [
        ...
        Alloy.createController('search').getView(),
        ...
    ],
      ...
});

search.xml:

<Alloy>
    <Window id="window">
        <View id="viewProducts">
            <Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="myRefresher">
                <ListView id="lvProducts" defaultItemTemplate="default">
                    ...
                </ListView>
            </Widget>
            <Label id="lbNoLocation" />
        </View>
    </Window>
</Alloy>
ghost commented 8 years ago

@ilker55 But you are using this widget https://github.com/FokkeZB/nl.fokkezb.pullToRefresh while reporting an issue on this widget https://github.com/iskugor/Ti.SwipeRefreshLayout

— Sent from Mailbox

On Fri, Sep 11, 2015 at 12:07 PM, Ilker notifications@github.com wrote:

I'm having the same issue. I have a home.js which creates a scrollableview. And one of the views is search.js which has a listview made in alloy. home.js:

Ti.App.tabGroup = Ti.UI.createScrollableView({
      views: [
          ...
          Alloy.createController('search').getView(),
          ...
  ],
    ...
});

search.xml:

<Alloy>
  <Window id="window">
      <View id="viewProducts">
          <Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="myRefresher">
              <ListView id="lvProducts" defaultItemTemplate="default">
                  ...
              </ListView>
          </Widget>
          <Label id="lbNoLocation" />
      </View>
  </Window>
</Alloy>

Reply to this email directly or view it on GitHub: https://github.com/iskugor/Ti.SwipeRefreshLayout/issues/15#issuecomment-139494140

ilker55 commented 8 years ago

@aggelos81 https://github.com/FokkeZB/nl.fokkezb.pullToRefresh uses com.rkam.swiperefreshlayout like yours, so i thought it was the same.

ilker55 commented 8 years ago

Btw I fixed it by updating to version 0.5.4 (I used 0.5.0) https://github.com/iskugor/Ti.SwipeRefreshLayout/blob/master/dist/com.rkam.swiperefreshlayout-android-0.5.4.zip. Maybe it will work for @jennaharris7 too.

iskugor commented 8 years ago

This seems to be all right with latest module.