From b2bc7ac3b7ddd60e5bf44e1df7589d2b4b152ffe Mon Sep 17 00:00:00 2001 From: Alexander Pantyuhov Date: Thu, 13 Oct 2016 23:57:15 +0300 Subject: [PATCH 1/2] Toolbar with dark content (#344) Former-commit-id: 5ffa5e073f400f858842856a293fa53c7ac8d4cf --- package.json | 2 +- src/status_im/android/platform.cljs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index eb23e34214..94e7efee8b 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "querystring-es3": "^0.2.1", "re-natal": "0.2.38", "react": "^15.3.1", - "react-native": "^0.34.0", + "react-native": "^0.36.0", "react-native-action-button": "^1.1.11", "react-native-android-sms-listener": "github:adrian-tiberius/react-native-android-sms-listener#listener-bugfix", "react-native-camera": "git+https://github.com/lwansbrough/react-native-camera.git", diff --git a/src/status_im/android/platform.cljs b/src/status_im/android/platform.cljs index 0c21c619b5..46b65910fc 100644 --- a/src/status_im/android/platform.cljs +++ b/src/status_im/android/platform.cljs @@ -1,16 +1,17 @@ (ns status-im.android.platform (:require [status-im.components.styles :as styles] - [status-im.utils.utils :as u])) + [status-im.utils.utils :as u] + [status-im.components.toolbar.styles :refer [toolbar-background2]])) (def component-styles {:status-bar {:default {:height 0 - :bar-style "default" - :color styles/color-gray} + :bar-style "dark-content" + :color styles/color-white} :main {:height 0 - :bar-style "default" - :color styles/color-gray} + :bar-style "dark-content" + :color toolbar-background2} :transparent {:height 20 - :bar-style "default" + :bar-style "light-content" :translucent? true :color styles/color-transparent}} :chat {:new-message {:border-top-color styles/color-transparent From b03e36db03bb34d7d511231d78bcf788201c0866 Mon Sep 17 00:00:00 2001 From: Alexander Pantyuhov Date: Mon, 31 Oct 2016 14:45:20 +0300 Subject: [PATCH 2/2] Support for React Native 0.36.0 Former-commit-id: c05956ec2e2cad730dd395eb92a51c56f758c8a4 --- src/status_im/chat/styles/datemark.cljs | 13 ++----- src/status_im/chat/styles/message.cljs | 3 +- src/status_im/chat/styles/suggestions.cljs | 3 +- src/status_im/chat/views/message.cljs | 34 +++++++---------- src/status_im/chat/views/request_message.cljs | 4 +- src/status_im/chat/views/suggestions.cljs | 37 +++++++------------ src/status_im/translations/en.cljs | 2 + 7 files changed, 38 insertions(+), 58 deletions(-) diff --git a/src/status_im/chat/styles/datemark.cljs b/src/status_im/chat/styles/datemark.cljs index 2517428f95..9a14bde363 100644 --- a/src/status_im/chat/styles/datemark.cljs +++ b/src/status_im/chat/styles/datemark.cljs @@ -1,17 +1,11 @@ (ns status-im.chat.styles.datemark) (def datemark-wrapper - {:flex 1 - :flex-direction :column - :align-items :center - :justify-content :center}) + {:flex 1 + :align-items :center}) (def datemark - {:flex 1 - :flex-direction :column - :align-items :center - :justify-content :center - :background-color "#bbc4cb33" + {:background-color "#bbc4cb33" :padding-left 12 :padding-right 12 :margin-top 8 @@ -21,4 +15,5 @@ (def datemark-text {:color "#838c93" + :top 4 :font-size 12}) \ No newline at end of file diff --git a/src/status_im/chat/styles/message.cljs b/src/status_im/chat/styles/message.cljs index 773e408c00..c42c6cffc5 100644 --- a/src/status_im/chat/styles/message.cljs +++ b/src/status_im/chat/styles/message.cljs @@ -175,7 +175,6 @@ {:marginTop 4 :height 14}) - (def content-command-view {:flexDirection :column}) @@ -262,7 +261,7 @@ :color text2-color}) (defn message-container [height] - {:height height}) + {:top height}) (defn new-message-container [margin on-top?] {:background-color color-white diff --git a/src/status_im/chat/styles/suggestions.cljs b/src/status_im/chat/styles/suggestions.cljs index 672396d919..2a85de1d74 100644 --- a/src/status_im/chat/styles/suggestions.cljs +++ b/src/status_im/chat/styles/suggestions.cljs @@ -10,7 +10,8 @@ separator-color text1-color text2-color - text3-color]])) + text3-color]] + [taoensso.timbre :as log])) (def suggestion-height 60) diff --git a/src/status_im/chat/views/message.cljs b/src/status_im/chat/views/message.cljs index 425ed31483..3f956cdb8e 100644 --- a/src/status_im/chat/views/message.cljs +++ b/src/status_im/chat/views/message.cljs @@ -255,37 +255,31 @@ [group-message-delivery-status message] [message-delivery-status message]))]) -(defn message-container-animation-logic [{:keys [to-value val callback]}] +(defn message-container-animation-logic [{:keys [top-offset callback]}] (fn [_] - (let [to-value @to-value] - (when (< 0 to-value) - (anim/start - (anim/timing val {:toValue to-value - :duration 250}) - (fn [arg] - (when (.-finished arg) - (callback)))))))) + (anim/start + (anim/timing top-offset {:toValue 0 + :duration 150}) + (fn [arg] + (when (.-finished arg) + (callback)))))) (defn message-container [message & children] (if (:new? message) - (let [layout-height (r/atom 0) - anim-value (anim/create-value 1) + (let [top-offset (anim/create-value 40) anim-callback #(dispatch [:set-message-shown message]) - context {:to-value layout-height - :val anim-value - :callback anim-callback} + context {:top-offset top-offset + :callback anim-callback} on-update (message-container-animation-logic context)] (r/create-class {:component-did-update + on-update + :component-did-mount on-update :reagent-render (fn [message & children] - @layout-height - [animated-view {:style (st/message-container anim-value)} - (into [view {:onLayout (fn [event] - (let [height (.. event -nativeEvent -layout -height)] - (reset! layout-height height)))}] - children)])})) + [animated-view {:style (st/message-container top-offset)} + (into [view] children)])})) (into [view] children))) (defn chat-message [{:keys [outgoing message-id chat-id user-statuses from]}] diff --git a/src/status_im/chat/views/request_message.cljs b/src/status_im/chat/views/request_message.cljs index 69df832dd5..4a639dc5cb 100644 --- a/src/status_im/chat/views/request_message.cljs +++ b/src/status_im/chat/views/request_message.cljs @@ -88,9 +88,9 @@ [text {:style st/style-message-text :font :default} content]]] - [request-button message-id command @status-initialized?] (when (:request-text command) [view st/command-request-text-view [text {:style st/style-sub-text :font :default} - (:request-text command)]])])))) + (:request-text command)]]) + [request-button message-id command @status-initialized?]])))) diff --git a/src/status_im/chat/views/suggestions.cljs b/src/status_im/chat/views/suggestions.cljs index c4b1837012..672a211453 100644 --- a/src/status_im/chat/views/suggestions.cljs +++ b/src/status_im/chat/views/suggestions.cljs @@ -19,7 +19,7 @@ [status-im.utils.platform :refer [ios?]] [status-im.chat.suggestions-responder :as resp] [status-im.chat.constants :as c] - [taoensso.timbre :as log])) + [status-im.i18n :refer [label]])) (defn set-command-input [command] (dispatch [:set-chat-command command])) @@ -40,12 +40,6 @@ [text {:style st/request-message-info} "By console, today at 14:50"]]]]) -(defn render-request-row - [{:keys [chat-id message-id] :as row} _ _] - (list-item - ^{:key [chat-id message-id]} - [request-item row])) - (defn suggestion-list-item [[command {:keys [description] name :name @@ -63,9 +57,6 @@ [view (st/suggestion-background suggestion) [text {:style st/suggestion-text} label]]]]]])) -(defn render-row [row _ _] - (list-item [suggestion-list-item row])) - (defn title [s] [view st/title-container [text {:style st/title-text} s]]) @@ -73,20 +64,18 @@ (defview suggestions-view [] [suggestions [:get-suggestions] requests [:get-requests]] - [scroll-view {:keyboardShouldPersistTaps true} - ;; todo translations - (when (seq requests) [title "Requests"]) - (when (seq requests) - [view - [list-view {:dataSource (to-datasource requests) - :keyboardShouldPersistTaps true - :renderRow render-request-row}]]) - ;; todo translations - [title "Commands"] - [view - [list-view {:dataSource (to-datasource suggestions) - :keyboardShouldPersistTaps true - :renderRow render-row}]]]) + [view {:flex 1} + [scroll-view {:keyboardShouldPersistTaps true} + (when (seq requests) + [title (label :t/suggestions-requests)]) + (when (seq requests) + (for [{:keys [chat-id message-id] :as request} requests] + ^{:key [chat-id message-id]} + [request-item request])) + [title (label :t/suggestions-commands)] + (for [suggestion suggestions] + ^{:key (first suggestion)} + [suggestion-list-item suggestion])]]) (defn header [h] (let [layout-height (subscribe [:max-layout-height :default]) diff --git a/src/status_im/translations/en.cljs b/src/status_im/translations/en.cljs index 145bc9cb5f..735442302f 100644 --- a/src/status_im/translations/en.cljs +++ b/src/status_im/translations/en.cljs @@ -28,6 +28,8 @@ :active-unknown "Unknown" :available "Available" :no-messages "No messages" + :suggestions-requests "Requests" + :suggestions-commands "Commands" ;sync :sync-in-progress "Syncing..."