Skip to content

Commit

Permalink
fix No tabs are available in the app on Graphene OS
Browse files Browse the repository at this point in the history
  • Loading branch information
Parveshdhull committed Oct 29, 2024
1 parent fd9e827 commit cd7d0da
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/status_im/contexts/onboarding/common/background/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,28 @@
(defonce is-dragging? (atom nil))
(defonce drag-amount (atom nil))

;; Layout height calculation
;; 1. Ensure that the height is greater than the width and that on-layout is not triggered while the
;; screen is horizontal.
;; 2. Initialize values to 0 in case they are nil.
;; 3. Always prefer on-layout height over window height, as some devices include status bar height in
;; the window while others do not.
;; https://github.com/status-im/status-mobile/issues/14633#issuecomment-1366191478
;; 4. This preference is unless on-layout is triggered with a random value.
;; https://github.com/status-im/status-mobile/issues/14849
;; To ensure that on-layout height falls within the actual height range, a difference between window
;; height and the maximum possible status bar height is allowed (assumed to be 60, as the Pixel emulator
;; has a height of 52).
(defn store-screen-height
[evt]
(let [window-height (:height (rn/get-window))
(let [window-height (or (:height (rn/get-window)) 0)
height (or (oget evt "nativeEvent" "layout" "height") 0)
width (or (oget evt "nativeEvent" "layout" "width") 0)]
;; Layout height calculation
;; 1. Make sure height is more than width, and on-layout is not fired while the
;; screen is horizontal
;; 2. Initialize values with 0 in case of nil
;; 3. In the case of notch devices, the dimensions height will be smaller than
;; on-layout,
;; (without status bar height included)
;; https://github.com/status-im/status-mobile/issues/14633
;; 4. In the case of devices without a notch, both heights should be the same,
;; but actual values differ in some pixels, so arbitrary 5 pixels is allowed
(when (and (> height width)
(>= (+ height 5) (or window-height 0))
(<= (Math/abs (- window-height height)) 60)
(not= height @shell.state/screen-height))
(reset! shell.state/screen-height height)
(async-storage/set-item! :screen-height height))))
(reset! shell.state/screen-height height)
(async-storage/set-item! :screen-height height))))

(defn view
[dark-overlay?]
Expand Down

0 comments on commit cd7d0da

Please sign in to comment.