Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25368] iOS: Appending view to scroll-view while scrolling, scrolls back to the top of the scroll-view

GitHub Issuen/a
TypeBug
PriorityCritical
StatusResolved
ResolutionNeeds more info
Resolution Date2017-10-11T13:04:50.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsiphone
Reporteralec@lilypad.co
AssigneeHans Knöchel
Created2017-10-03T21:00:17.000+0000
Updated2017-10-11T13:04:51.000+0000

Description

Trying to execute an infinite scroll so when the user scrolls to a certain point the feed will append more rows but when appendrow is called the tableview tries to scroll back to the top of the table which is leading to an annoying situation. This has worked fine up until recently. Thank you in advance

Comments

  1. Hans Knöchel 2017-10-04

    Hey there, can you provide a simple example code to reproduce this issue? Thank you!
  2. Peter Ladis 2017-10-04

    Hans...im on the same team....So what we have is a table that implements infinite scroll....this is achieved by this: if (distance < ScrollView.lastDistance) { // adjust the % of rows scrolled before we decide to start fetching var percentage = .60; if (args.percentage) percentage = args.percentage; var nearEnd = theEnd * percentage; var newBottom = theEnd; if (ScrollView.loading == false && total >= nearEnd) { nearBottom = true; if(nearBottom){ ScrollView.loading = true; ScrollView.fireEvent('InfiniteScrolling'); } } if (total >= newBottom) { ScrollView.fireEvent('BottomList'); } } When the above code is met....it tells the parent code to load more items from the database. This happens successfully. When the new values are received from the database we call appendRow(). After all the values are loaded in....we tell the control that we are done loading.... ****what appears to happen is...appendrow() is actually moving the table all around causing the height check to fire multiple time..giving the illusion that the table is bouncing all over the place. Another side note is after we appendrow() causes the scrollToview(0)...not to working anymore like it did in IOS10.....i solved this by changing it to scrolltoindex(0) Thoughts?
  3. Hans Knöchel 2017-10-04

    Hey Peter, sorry but your example-code seems incomplete to create an infinite-scroll use-case. Also, please test with the latest 6.3.0 build (e.g. by using appc ti sdk install -b 6_3_X or download [here](http://builds.appcelerator.com/#6_3_X) where already many iOS 11 changes are included. For the scrollToView bug, it is a known iOS 11 issue and I filed a ticket at Apple about it already.
  4. alec@lilypad.co 2017-10-04

    Hey Hans, I installed the build using appc ti sdk install -b 6_3_X but when i try to run it against our app i get this error, which isnt allowing for compilation of the app. SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
  5. alec@lilypad.co 2017-10-05

    Hey Hans, Just wanted to see where everything stands for this issue?
  6. Peter Ladis 2017-10-05

    Here is my full stack trace: 2017-10-05T14:27:26.261Z | TRACE | session already loaded in opts.session 2017-10-05T14:27:26.263Z | DEBUG | Titanium Downloads Last Checked: 1507204534979 2017-10-05T14:27:27.157Z | ERROR | An uncaught exception was thrown! Block-scoped declarations (let, const, function, class) not yet supported outside strict mode 2017-10-05T14:27:27.157Z | ERROR | Block-scoped declarations (let, const, function, class) not yet supported outside strict mode 2017-10-05T14:27:27.157Z | TRACE | SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:373:25) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at /Users/pladis/Library/Application Support/Titanium/mobilesdk/osx/6.3.0.v20171004141749/node_modules/node-titanium-sdk/lib/titanium.js:97:14 at /Users/pladis/Library/Application Support/Titanium/mobilesdk/osx/6.3.0.v20171004141749/node_modules/node-titanium-sdk/node_modules/async/dist/async.js:3853:24 at eachOfArrayLike (/Users/pladis/Library/Application Support/Titanium/mobilesdk/osx/6.3.0.v20171004141749/node_modules/node-titanium-sdk/node_modules/async/dist/async.js:1003:9) at eachOf (/Users/pladis/Library/Application Support/Titanium/mobilesdk/osx/6.3.0.v20171004141749/node_modules/node-titanium-sdk/node_modules/async/dist/async.js:1051:5) at _parallel (/Users/pladis/Library/Application Support/Titanium/mobilesdk/osx/6.3.0.v20171004141749/node_modules/node-titanium-sdk/node_modules/async/dist/async.js:3852:5) at Object.parallelLimit [as parallel] (/Users/pladis/Library/Application Support/Titanium/mobilesdk/osx/6.3.0.v20171004141749/node_modules/node-titanium-sdk/node_modules/async/dist/async.js:3935:5) at Object.exports.platformOptions (/Users/pladis/Library/Application Support/Titanium/mobilesdk/osx/6.3.0.v20171004141749/node_modules/node-titanium-sdk/lib/titanium.js:81:8) at /Users/pladis/Library/Application Support/Titanium/mobilesdk/osx/6.3.0.v20171004141749/cli/commands/build.js:49:7 at /Users/pladis/.appcelerator/install/6.2.4/package/node_modules/titanium/lib/hook.js:256:13 --------------------------------------------- at Object.run (/Users/pladis/.appcelerator/install/6.2.4/package/node_modules/titanium/node_modules/node-appc/lib/subprocess.js:59:8) at find (/Users/pladis/.appcelerator/install/6.2.4/package/node_modules/titanium/node_modules/node-appc/lib/subprocess.js:96:14) at /Users/pladis/.appcelerator/install/6.2.4/package/node_modules/titanium/node_modules/node-appc/node_modules/async/dist/async.js:3894:5 at q.process (/Users/pladis/.appcelerator/install/6.2.4/package/node_modules/titanium/node_modules/node-appc/node_modules/async/dist/async.js:2299:17) at Immediate._onImmediate (/Users/pladis/.appcelerator/install/6.2.4/package/node_modules/titanium/node_modules/node-appc/node_modules/async/dist/async.js:2112:16) at processImmediate [as _immediateCallback] (timers.js:396:17)
  7. alec@lilypad.co 2017-10-06

    Hey Hans, Wondering if there is any update you could give me on this issue or a possible work around for the time being, it's leading to a pretty bad user experience and we would like to get something working correctly as soon as possible.
  8. Hans Knöchel 2017-10-10

    Unfortunately there is still no full test-case to reproduce, just part of a snippet that does not have any context. If we cannot receive a test-case to actually reproduce it, we won't be able to address this and probably need to move it out of the next release.
  9. Hans Knöchel 2017-10-11

    I have one thing that *could* cause it: Try to edit the TiUIScrollView.m in ~/Library/Application Support/Titanium/mobilesdk/osx/<your-sdk>/iphone/Classes to include the following inside the -(TiUIScrollViewImpl *)scrollView method - before \[self addSubview:scrollView\];:
       #if IS_XCODE_9
           if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
             [scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
           }
       #endif
       

JSON Source