2

I am using ScrollView with vertical layout to show the messages, as message screen opens up it should display the messages from bottom, not from the top. I tried using scrollToBottom, but problem with this one can see the transition. We don't see any transition while opening whatsapp message screen, how can I achieve the same?

Dipa Das
  • 75
  • 5

1 Answers1

2

Whatsapp, and other messenger services out there, use a collectionView. Scrollview is intended for small sets of data or things like forms.

CollectionView is available as a module on GitHub.

Other solutions are a ListView for example. You can scroll to the bottom without animations. Just take a good look at the documentation

Rene Pot
  • 24,681
  • 7
  • 68
  • 92
  • I picked ScrollView over ListView as I need to embed different types of forms with varying numbers of controls at different point of time during user conversation. So message screen consist of texts, images and forms(Like category selection, payment, feedback etc). With ListView I find it difficult to create templates which can handle varying controls. Same problem with CollectionView. Is TableView is good option over ScrollView? Can it solve the problem? – Dipa Das Dec 14 '17 at 12:03
  • tableview is also better, but templates are perfect for dynamic things... and you have no limitation on the number of templates. Come to http://tislack.org and talk it over with the community to help you out. – Rene Pot Dec 15 '17 at 09:51
  • Thank you. I have joined tislack. I switched to ListView. ListView bottom set to 80dp and an auto grow TextArea at the bottom. I am facing couple of issues. 1) ListView bottom should always stick to TextArea top as TextArea height increases. 2. How to add listItems to the ListView from bottom not from the top 3. With the above design on IOS, TextArea is getting hidden by keyboard on focus. I tried wrapping the views by ScrollView, when I scroll both ListView and ScrollView are scrolling, only ListView should scroll not ScrollView – Dipa Das Dec 15 '17 at 12:25
  • we're stearing off topic here. Your original question was answered. You should start chatting @ tislack.At Stackoverflow you're supposed to show what you've already tried, in code. – Rene Pot Dec 15 '17 at 12:51