This commit is contained in:
Omar Basem
2022-12-16 11:33:32 +04:00
parent ee7d11c89e
commit 485ced2028
2 changed files with 53 additions and 23 deletions
@@ -68,19 +68,20 @@
(defn get-bottom-sheet-gesture [context translate-y text-input-ref keyboard-shown min-y max-y shared-height max-height set-bg-opacity]
(-> (gesture/gesture-pan)
(gesture/on-start
(fn [_]
(if keyboard-shown
(swap! context assoc :pan-y (reanimated/get-shared-value translate-y))
(input/input-focus text-input-ref))))
(fn [_]
(if keyboard-shown
(swap! context assoc :pan-y (reanimated/get-shared-value translate-y))
(input/input-focus text-input-ref))))
(gesture/on-update
(fn [evt]
(when keyboard-shown
(swap! context assoc :dy (- (.-translationY evt) (:pdy @context)))
(swap! context assoc :pdy (.-translationY evt))
(reanimated/set-shared-value
translate-y
(max (min (+ (.-translationY evt) (:pan-y @context)) (- min-y)) (- max-y))))))
(fn [evt]
(when keyboard-shown
(swap! context assoc :dy (- (.-translationY evt) (:pdy @context)))
(swap! context assoc :pdy (.-translationY evt))
(reanimated/set-shared-value
translate-y
(max (min (+ (.-translationY evt) (:pan-y @context)) (- min-y)) (- max-y))))))
(gesture/on-end
<<<<<<< HEAD
(fn [_]
(when keyboard-shown
(if (< (:dy @context) 0)
@@ -95,6 +96,23 @@
(reanimated/set-shared-value shared-height (reanimated/with-timing min-y))
(set-bg-opacity 0)
(re-frame/dispatch [:dismiss-keyboard]))))))))
=======
(fn [_]
(when keyboard-shown
(if (< (:dy @context) 0)
(do
(swap! context assoc :state :max)
(input/input-focus text-input-ref)
(reanimated/set-shared-value translate-y (reanimated/with-timing (- max-y)))
(reanimated/set-shared-value shared-height (reanimated/with-timing max-height))
(set-bg-opacity 1))
(do
(swap! context assoc :state :min)
(reanimated/set-shared-value translate-y (reanimated/with-timing (- min-y)))
(reanimated/set-shared-value shared-height (reanimated/with-timing min-y))
(set-bg-opacity 0)
(re-frame/dispatch [:dismiss-keyboard]))))))))
>>>>>>> e49307faa... updates
(defn get-input-content-change [context translate-y shared-height max-height set-bg-opacity keyboard-shown min-y max-y]
(fn [evt]
@@ -120,19 +138,19 @@
(swap! context assoc :y new-y)
(when keyboard-shown
(reanimated/set-shared-value
translate-y
(reanimated/with-timing (- new-y)))
translate-y
(reanimated/with-timing (- new-y)))
(reanimated/set-shared-value
shared-height
(reanimated/with-timing (min new-y max-height)))))
shared-height
(reanimated/with-timing (min new-y max-height)))))
(do
(swap! context assoc :state :max)
(swap! context assoc :y max-y)
(when keyboard-shown
(set-bg-opacity 1)
(reanimated/set-shared-value
translate-y
(reanimated/with-timing (- max-y)))))))))))
translate-y
(reanimated/with-timing (- max-y)))))))))))
(defn composer [chat-id]
[safe-area/consumer
@@ -230,13 +248,13 @@
(re-frame/dispatch [:dismiss-keyboard])) edit)
>>>>>>> 40e3ab29c... lint
[reanimated/view {:style (reanimated/apply-animations-to-style
{:height shared-height}
{:z-index 2})}
{:height shared-height}
{:z-index 2})}
;;INPUT MESSAGE bottom sheet
[gesture/gesture-detector {:gesture bottom-sheet-gesture}
[reanimated/view {:style (reanimated/apply-animations-to-style
{:transform [{:translateY translate-y}]}
(style/input-bottom-sheet window-height))}
{:transform [{:translateY translate-y}]}
(style/input-bottom-sheet window-height))}
;handle
<<<<<<< HEAD
[rn/view {:style (styles/bottom-sheet-handle)}]
@@ -261,6 +279,7 @@
(permissions/request-permissions
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 40e3ab29c... lint
{:permissions [:read-external-storage :write-external-storage]
@@ -275,6 +294,8 @@
:type :outline
:size 32} :i/image]
=======
=======
>>>>>>> e49307faa... updates
{:permissions [:read-external-storage :write-external-storage]
:on-allowed #(re-frame/dispatch [:bottom-sheet/show-sheet
{:content [photo-selector/photo-selector]}])
@@ -282,8 +303,11 @@
(utils/set-timeout
#(utils/show-popup (i18n/label :t/error)
(i18n/label :t/external-storage-denied)) 50))}))
<<<<<<< HEAD
=======
>>>>>>> 40e3ab29c... lint
=======
>>>>>>> e49307faa... updates
:icon true :type :outline :size 32} :i/image]
>>>>>>> ff3badc39... tests
[rn/view {:width 12}]
@@ -305,6 +329,7 @@
[reanimated/view {:style (reanimated/apply-animations-to-style
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
{:opacity bg-opacity
:transform [{:translateY bg-bottom}]}
@@ -322,6 +347,11 @@
>>>>>>> 40e3ab29c... lint
{:opacity bg-opacity}
(style/bottom-sheet-background window-height))}]
=======
{:opacity bg-opacity
:transform [{:translateY bg-bottom}]}
(style/bottom-sheet-background window-height))}]
>>>>>>> e49307faa... updates
[composer-images/images-list images]
[mentions/autocomplete-mentions suggestions]]))])))])
>>>>>>> ea730ed53... lint
+2 -2
View File
@@ -5,12 +5,12 @@
["react-native" :refer (DevSettings LogBox)]))
;; Ignore all logs, because there are lots of temporary warnings when developing and hot reloading
(.ignoreAllLogs LogBox)
;(.ignoreAllLogs LogBox)
;; Only ignore warnings/errors that cannot be fixed for the time being.
;; When you add a warning to be ignored explain below why it is ignored and how it can be fixed.
;; When a warning is fixed make sure to remove it from here.
#_(.ignoreLogs ^js LogBox (clj->js ["undefined is not an object (evaluating 'e.message')"
(.ignoreLogs ^js LogBox (clj->js ["undefined is not an object (evaluating 'e.message')"
"Cannot read property 'message' of undefined"
"InternalError Metro has encountered an error"
"undefined Unable to resolve module `parse-svg-path`"