icerockdev / moko-widgets

Multiplatform UI DSL with screen management in common code for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev
Apache License 2.0
387 stars 32 forks source link

Add support for horizontal scrolling in ScrollWidget #238

Open stevesoltys opened 4 years ago

stevesoltys commented 4 years ago

I am trying to implement a UIScrollView which can be scrolled horizontally.

I believe this is not currently supported, as per this comment: https://github.com/icerockdev/moko-widgets/blob/master/widgets/src/commonMain/kotlin/dev/icerock/moko/widgets/ScrollWidget.kt#L23

I may be missing something, please let me know if I am.

stevesoltys commented 4 years ago

I was able to solve my particular case with the CollectionWidget. However, I will leave the issue open because I believe (?) it still applies.

Side question: Will the CollectionWidget become part of the regular widgets available to the project? Meaning, is it a work in progress and that's why it isn't part of the library yet?

Alex009 commented 4 years ago

hi! for now ScrollWidget not have configuration of orientation (but we add it later. as part of this issue).

about CollectionWidget:

  1. collection widget on iOS now work not good in case of multiple columns. but if you use one column (or one row in horizontal orientation) - all should be good
  2. collection just like list will reuse items when scroll, so you should not add any input controls into this (keyboard will be crazy in cases of reuse items at scroll)
  3. CollectionWidget placed in widgets-collection because it require additional Swift CocoaPod for iOS. core widgets module not require any additional modules. it not mean that "it's not part of library" - any of modules in this repository is part of moko-widgets. Separation by modules required for more control of applied dependencies in target application
stevesoltys commented 4 years ago

Thanks for the reply @Alex009.

  1. I am using one row in horizontal direction, so should be fine here.
  2. Good to know. Just showing images for now. So I think should be good there too.
  3. I see. Is this module available in Maven currently? That is what I meant by "part of the library" - I didn't see if it was being published or not. If it is available as a Maven dependency, could you point me to the artifact I should depend on? I ask because I do not see it in 0.1.0-dev-19 currently.
Alex009 commented 4 years ago

@stevesoltys yes, it's available in maven - https://bintray.com/icerockdev/moko/moko-widgets/0.1.0-dev-19#files/dev%2Ficerock%2Fmoko%2Fwidgets-collection

also you can use current development version (from develop branch) - it publish on maven too: https://bintray.com/icerockdev/moko-dev/moko-widgets https://bintray.com/icerockdev/plugins-dev/moko-widgets-generator and just set commit sha as version name (d4201af latest now) but by using develop version you will not got migration notes and changelog. here already many changes - https://github.com/icerockdev/moko-widgets/compare/develop but it have many improvements https://github.com/icerockdev/moko-widgets/milestone/15?closed=1

stevesoltys commented 4 years ago

Got it. I'm all set now. Thanks!