using KeyboardAvoidingView to fix the issue

This commit is contained in:
Gustavo Nunes 2017-03-21 21:51:41 -03:00 committed by Roman Volosovskyi
parent 141246e8d5
commit a116600679
5 changed files with 30 additions and 14 deletions

View File

@ -30,6 +30,7 @@
(def list-view-class (get-class "ListView")) (def list-view-class (get-class "ListView"))
(def scroll-view (get-class "ScrollView")) (def scroll-view (get-class "ScrollView"))
(def web-view (get-class "WebView")) (def web-view (get-class "WebView"))
(def keyboard-avoiding-view (get-class "KeyboardAvoidingView"))
(def text-class (get-class "Text")) (def text-class (get-class "Text"))
(def text-input-class (get-class "TextInput")) (def text-input-class (get-class "TextInput"))

View File

@ -4,6 +4,7 @@
[status-im.contacts.views.contact :refer [contact-view]] [status-im.contacts.views.contact :refer [contact-view]]
[status-im.components.react :refer [view [status-im.components.react :refer [view
scroll-view scroll-view
keyboard-avoiding-view
list-view list-view
list-item]] list-item]]
[status-im.components.confirm-button :refer [confirm-button]] [status-im.components.confirm-button :refer [confirm-button]]
@ -18,6 +19,7 @@
separator]] separator]]
[status-im.new-group.validations :as v] [status-im.new-group.validations :as v]
[status-im.i18n :refer [label]] [status-im.i18n :refer [label]]
[status-im.utils.platform :refer [ios?]]
[cljs.spec :as s])) [cljs.spec :as s]))
(def contacts-limit 3) (def contacts-limit 3)
@ -55,16 +57,17 @@
type [:get :group-type]] type [:get :group-type]]
(let [save-btn-enabled? (and (s/valid? ::v/name group-name) (let [save-btn-enabled? (and (s/valid? ::v/name group-name)
(not= group-name (:name group)))] (not= group-name (:name group)))]
[view st/group-container [(if ios? keyboard-avoiding-view view) (merge {:behavior :padding}
st/group-container)
[group-toolbar type true] [group-toolbar type true]
[group-name-view] [group-name-view]
[add-btn #(dispatch [:navigate-to :add-contacts-toggle-list])] [view {:flex 1}
[group-contacts-view group] [add-btn #(dispatch [:navigate-to :add-contacts-toggle-list])]
[view st/separator] [group-contacts-view group]
[delete-btn #(do [view st/separator]
(dispatch [:delete-group]) [delete-btn #(do
(dispatch [:navigate-to-clean :contact-list]))] (dispatch [:delete-group])
[view {:flex 1}] (dispatch [:navigate-to-clean :contact-list]))]]
(when save-btn-enabled? (when save-btn-enabled?
[confirm-button (label :t/save) save])])) [confirm-button (label :t/save) save])]))
@ -83,7 +86,8 @@
group-name [:get :new-chat-name] group-name [:get :new-chat-name]
group-type [:get :group-type]] group-type [:get :group-type]]
(let [save-btn-enabled? (and (s/valid? ::v/name group-name) (pos? (count contacts)))] (let [save-btn-enabled? (and (s/valid? ::v/name group-name) (pos? (count contacts)))]
[view st/group-container [(if ios? keyboard-avoiding-view view) (merge {:behavior :padding}
st/group-container)
[group-toolbar group-type false] [group-toolbar group-type false]
[group-name-view] [group-name-view]
[view {:flex 1} [view {:flex 1}

View File

@ -4,6 +4,7 @@
[status-im.contacts.views.contact :refer [contact-view]] [status-im.contacts.views.contact :refer [contact-view]]
[status-im.components.react :refer [view [status-im.components.react :refer [view
scroll-view scroll-view
keyboard-avoiding-view
icon icon
touchable-highlight]] touchable-highlight]]
[status-im.components.confirm-button :refer [confirm-button]] [status-im.components.confirm-button :refer [confirm-button]]
@ -17,6 +18,7 @@
separator]] separator]]
[status-im.new-group.validations :as v] [status-im.new-group.validations :as v]
[status-im.i18n :refer [label]] [status-im.i18n :refer [label]]
[status-im.utils.platform :refer [ios?]]
[cljs.spec :as s])) [cljs.spec :as s]))
(def contacts-limit 3) (def contacts-limit 3)
@ -65,7 +67,8 @@
type [:get :group-type]] type [:get :group-type]]
(let [save-btn-enabled? (and (s/valid? ::v/name new-chat-name) (let [save-btn-enabled? (and (s/valid? ::v/name new-chat-name)
(not= new-chat-name chat-name))] (not= new-chat-name chat-name))]
[view st/group-container [(if ios? keyboard-avoiding-view view) (merge {:behavior :padding}
st/group-container)
[view {:flex 1} [view {:flex 1}
[group-toolbar type true] [group-toolbar type true]
[scroll-view [scroll-view

View File

@ -3,6 +3,7 @@
(:require [re-frame.core :refer [dispatch]] (:require [re-frame.core :refer [dispatch]]
[status-im.contacts.views.contact :refer [contact-view]] [status-im.contacts.views.contact :refer [contact-view]]
[status-im.components.react :refer [view [status-im.components.react :refer [view
keyboard-avoiding-view
text text
list-view list-view
list-item]] list-item]]
@ -10,6 +11,7 @@
[status-im.components.status-bar :refer [status-bar]] [status-im.components.status-bar :refer [status-bar]]
[status-im.components.toolbar-new.view :refer [toolbar-with-search]] [status-im.components.toolbar-new.view :refer [toolbar-with-search]]
[status-im.utils.listview :refer [to-datasource]] [status-im.utils.listview :refer [to-datasource]]
[status-im.utils.platform :refer [ios?]]
[status-im.new-group.views.toggle-contact :refer [group-toggle-contact [status-im.new-group.views.toggle-contact :refer [group-toggle-contact
group-toggle-participant]] group-toggle-participant]]
[status-im.components.common.common :refer [separator]] [status-im.components.common.common :refer [separator]]
@ -50,7 +52,8 @@
[contacts [:all-added-group-contacts-filtered] [contacts [:all-added-group-contacts-filtered]
selected-contacts-count [:selected-contacts-count] selected-contacts-count [:selected-contacts-count]
group-type [:get :group-type]] group-type [:get :group-type]]
[view st/group-container [(if ios? keyboard-avoiding-view view) (merge {:behavior :padding}
st/group-container)
[status-bar] [status-bar]
[toggle-list-toolbar [toggle-list-toolbar
(label (if (= group-type :contact-group) (label (if (= group-type :contact-group)
@ -74,7 +77,8 @@
[contacts [:all-group-not-added-contacts-filtered] [contacts [:all-group-not-added-contacts-filtered]
group [:get-contact-group] group [:get-contact-group]
selected-contacts-count [:selected-contacts-count]] selected-contacts-count [:selected-contacts-count]]
[view st/group-container [(if ios? keyboard-avoiding-view view) (merge {:behavior :padding}
st/group-container)
[status-bar] [status-bar]
[toggle-list-toolbar (:name group) selected-contacts-count] [toggle-list-toolbar (:name group) selected-contacts-count]
[view {:flex 1} [view {:flex 1}
@ -96,7 +100,8 @@
[contacts [:contacts-filtered :all-new-contacts] [contacts [:contacts-filtered :all-new-contacts]
chat-name [:chat :name] chat-name [:chat :name]
selected-contacts-count [:selected-participants-count]] selected-contacts-count [:selected-participants-count]]
[view st/group-container [(if ios? keyboard-avoiding-view view) (merge {:behavior :padding}
st/group-container)
[status-bar] [status-bar]
[toggle-list-toolbar chat-name selected-contacts-count] [toggle-list-toolbar chat-name selected-contacts-count]
[view {:flex 1} [view {:flex 1}

View File

@ -14,9 +14,11 @@
[status-im.profile.validations :as v] [status-im.profile.validations :as v]
[status-im.components.react :refer [view [status-im.components.react :refer [view
scroll-view scroll-view
keyboard-avoiding-view
text text
touchable-highlight touchable-highlight
text-input]] text-input]]
[status-im.utils.platform :refer [ios?]]
[cljs.spec :as s])) [cljs.spec :as s]))
(defn edit-my-profile-toolbartoolbar [] (defn edit-my-profile-toolbartoolbar []
@ -77,7 +79,8 @@
profile-edit-data-changed? (or (not= (:name current-account) (:name changed-account)) profile-edit-data-changed? (or (not= (:name current-account) (:name changed-account))
(not= (:status current-account) (:status changed-account)) (not= (:status current-account) (:status changed-account))
(not= (:photo-path current-account) (:photo-path changed-account)))] (not= (:photo-path current-account) (:photo-path changed-account)))]
[view st/profile [(if ios? keyboard-avoiding-view view) (merge {:behavior :padding}
st/profile)
[status-bar] [status-bar]
[edit-my-profile-toolbartoolbar] [edit-my-profile-toolbartoolbar]
[view {:flex 1} [view {:flex 1}