polydice / ICInputAccessory

A customized token text field used in the iCook app.
http://polydice.com/ICInputAccessory/
MIT License
52 stars 18 forks source link

Multiline TextField Like Native iOS Token View #14

Open basilmariano opened 7 years ago

basilmariano commented 7 years ago

Can we use textView instead on textField to support multi line? This library is more beautiful than the others.

oh +100 fir this feature.

Thanks

bcylin commented 7 years ago

Thanks for the feedback. I believe the original design didn’t involve multiline layout in order to keep it simple, hence the horizontal scrolling.

It definitely requires some design updates to build multiline support on top of the current behaviour. Any good ideas?

trisix commented 7 years ago

Hi, I designed the UI and UI interaction for this component. And with @bcylin 's great talents, we make this library.

Some Random Thoughts About This Issue In Chinese

(Not Actually A Native Speaker So Thinking And Typing In Chinese Is Faster For Me)

大致上想像是:

  1. 現有的token 其實不太需要動,會要動的是token的layout方式

  2. 如果要相容現有的,可能需要某種 maxNumberOfLines ? (如果是1 ,那應該行為就跟目前一樣,如果大於1, 就變成類系統Mail,或是Facebook發文時的權限控制那邊的那種多行直向滑動的)

或是一個bool ?(isMultipleLinesEnabled 之類的)去判斷是否是單行橫向滑動模式(bool 是因為,可能沒有要限制到底內容有多少行,可能是要可以一直打,所以差別只有是不是單行),但這只是很單純粗淺的想法,真的要實作的話也許有更好的方式

  1. 同時多行除了內容多行,另一部分要確定的會是,那要顯示的會是幾行?可能需要某種 maxVisibleNumberOfLines ?這也會影響其他部分的高度增長

舉例來說:上面提到的Facebook 的大致上是可以顯示到2行,但實際內容應該沒有限制,所以token還能顯示在一行內的時候,高度就只有1行的高度,到了得用兩行才放得下的時候,高度就對應變成2行,但當內容到了得超過兩行才放得下的時候,高度就還是2行的高度

但iOS 自己的Mail或是Gmail的收件人那欄,就是一直增長高度的那種,但是一但focus離開那個欄位,就會縮到一行的高度,而且變成概述的文字

但上述兩種的目的和用途不太一樣,如果要說的話,會覺得以延續之前一開始的設計和用途的話,會比較像是前面的Facebook那種,因為主要用途不是打很多,而是比較像是提供一些filter的options

但這個issue的標題應該是比較想像Mail那種?

但不管是哪種,其實主要變動會是Layout的方式,單行橫向當然還是跟現在一樣,但當不是單行的時候,就會變成要看scrollview的width來決定token的擺放的位置要不要換行

  1. 因為前面有個可自定的icon,所以看要做到怎麼樣,也許相對簡單的會是行數增加高度增高的時候,第二行的最左邊其實是對齊第一行的最左邊的
    (icon)  [tokenInLine1]...
        [tokenInLine2]...

    Facebook的會是上面講的那種,但因為他最多只顯示兩行(剩下要滑動才看得到),所以左側icon下方的留白不會太多

iOS 的Mail會是跟收件人那個欄位標註對齊,

(icon) [tokenInLine1]....
[tokenInLine2]...

這種的排列方式有可能就會動到現有比較多東西

bcylin commented 7 years ago

Perhaps it'd go through less trouble if the multiline layout could be achieved using a separate class? It's also easier to maintain code-wise.

trisix commented 7 years ago

Yes, I think so.