Skip to content

Commit cd69d04

Browse files
authored
fix (fn[]) usage in hiccup (#15713)
1 parent 2fe4956 commit cd69d04

File tree

75 files changed

+2149
-2424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+2149
-2424
lines changed

ios/Podfile.lock

+9-9
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,6 @@ PODS:
256256
- React-Core
257257
- react-native-randombytes (3.6.1):
258258
- React-Core
259-
- react-native-safe-area-context (2.0.0):
260-
- React
261259
- react-native-shake (3.4.0):
262260
- React
263261
- react-native-slider (3.0.0):
@@ -412,6 +410,8 @@ PODS:
412410
- Yoga
413411
- RNShare (7.0.1):
414412
- React-Core
413+
- RNStaticSafeAreaInsets (2.2.0):
414+
- React-Core
415415
- RNSVG (9.13.6):
416416
- React
417417
- SDWebImage (5.11.1):
@@ -468,7 +468,6 @@ DEPENDENCIES:
468468
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
469469
- react-native-orientation-locker (from `../node_modules/react-native-orientation-locker`)
470470
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
471-
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
472471
- react-native-shake (from `../node_modules/react-native-shake`)
473472
- "react-native-slider (from `../node_modules/@react-native-community/slider`)"
474473
- react-native-status (from `../modules/react-native-status`)
@@ -503,6 +502,7 @@ DEPENDENCIES:
503502
- RNReactNativeHapticFeedback (from `../node_modules/react-native-haptic-feedback`)
504503
- RNReanimated (from `../node_modules/react-native-reanimated`)
505504
- RNShare (from `../node_modules/react-native-share`)
505+
- RNStaticSafeAreaInsets (from `../node_modules/react-native-static-safe-area-insets`)
506506
- RNSVG (from `../node_modules/react-native-svg`)
507507
- secp256k1 (from `https://github.com/status-im/secp256k1.swift.git`)
508508
- SQLCipher (~> 3.0)
@@ -589,8 +589,6 @@ EXTERNAL SOURCES:
589589
:path: "../node_modules/react-native-orientation-locker"
590590
react-native-randombytes:
591591
:path: "../node_modules/react-native-randombytes"
592-
react-native-safe-area-context:
593-
:path: "../node_modules/react-native-safe-area-context"
594592
react-native-shake:
595593
:path: "../node_modules/react-native-shake"
596594
react-native-slider:
@@ -659,6 +657,8 @@ EXTERNAL SOURCES:
659657
:path: "../node_modules/react-native-reanimated"
660658
RNShare:
661659
:path: "../node_modules/react-native-share"
660+
RNStaticSafeAreaInsets:
661+
:path: "../node_modules/react-native-static-safe-area-insets"
662662
RNSVG:
663663
:path: "../node_modules/react-native-svg"
664664
secp256k1:
@@ -682,11 +682,11 @@ SPEC CHECKSUMS:
682682
boost: a7c83b31436843459a1961bfd74b96033dc77234
683683
BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872
684684
CryptoSwift: c4f2debceb38bf44c80659afe009f71e23e4a082
685-
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
685+
DoubleConversion: cde416483dac037923206447da6e1454df403714
686686
FBLazyVector: d2db9d00883282819d03bbd401b2ad4360d47580
687687
FBReactNativeSpec: 94da4d84ba3b1acf459103320882daa481a2b62d
688688
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
689-
glog: 9e3310013355e9221591364060e841c28041dfe3
689+
glog: 997518ea2aa2d8cd5df9797b641b758d52ecf2bc
690690
HMSegmentedControl: 34c1f54d822d8308e7b24f5d901ec674dfa31352
691691
Keycard: ac6df4d91525c3c82635ac24d4ddd9a80aca5fc8
692692
libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef
@@ -716,7 +716,6 @@ SPEC CHECKSUMS:
716716
react-native-netinfo: ddaca8bbb9e6e914b1a23787ccb879bc642931c9
717717
react-native-orientation-locker: 851f6510d8046ea2f14aa169b1e01fcd309a94ba
718718
react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846
719-
react-native-safe-area-context: 60f654e00b6cc416573f6d5dbfce3839958eb57a
720719
react-native-shake: de052eaa3eadc4a326b8ddd7ac80c06e8d84528c
721720
react-native-slider: 12bd76d3d568c9c5500825db54123d44b48e4ad4
722721
react-native-status: 21f75d492fd311dc111303da38a7a2b23a8a8466
@@ -751,6 +750,7 @@ SPEC CHECKSUMS:
751750
RNReactNativeHapticFeedback: 2566b468cc8d0e7bb2f84b23adc0f4614594d071
752751
RNReanimated: 3ad6ec4e147462206be9d1c925df10b6ea850b0e
753752
RNShare: 2dc2fcac3f7321cfd6b60a23ed4bf4d549f86f5f
753+
RNStaticSafeAreaInsets: 055ddbf5e476321720457cdaeec0ff2ba40ec1b8
754754
RNSVG: 8ba35cbeb385a52fd960fd28db9d7d18b4c2974f
755755
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
756756
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
@@ -763,4 +763,4 @@ SPEC CHECKSUMS:
763763

764764
PODFILE CHECKSUM: c29de3b14e3275299c51aa95520622f09d084bcb
765765

766-
COCOAPODS: 1.12.0
766+
COCOAPODS: 1.12.1

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@
6363
"react-native-randombytes": "^3.6.1",
6464
"react-native-reanimated": "2.3.3",
6565
"react-native-redash": "^16.0.11",
66-
"react-native-safe-area-context": "^2.0.0",
6766
"react-native-shake": "^3.3.1",
6867
"react-native-share": "^7.0.1",
68+
"react-native-static-safe-area-insets": "^2.2.0",
6969
"react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#refs/tags/v2.5.39",
7070
"react-native-svg": "^9.8.4",
7171
"react-native-touch-id": "^4.4.1",

src/mocks/js_dependencies.cljs

+2-5
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,7 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
155155
(def net-info #js {})
156156
(def touchid #js {})
157157
(def react-native-image-viewing #js {:default {}})
158-
(def safe-area-context
159-
(clj->js {:SafeAreaProvider {:_reactNativeIphoneXHelper {:getStatusBarHeight (fn [])}}
160-
:SafeAreaInsetsContext {:Consumer (fn [])}
161-
:SafeAreaView {}}))
158+
(def react-native-static-safe-area-insets #js {:default {}})
162159

163160
(def back-handler
164161
#js
@@ -367,7 +364,7 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
367364
"react-native-background-timer" background-timer
368365
"react-native-image-crop-picker" image-crop-picker
369366
"react-native-gesture-handler" react-native-gesture-handler
370-
"react-native-safe-area-context" safe-area-context
367+
"react-native-static-safe-area-insets" react-native-static-safe-area-insets
371368
"react-native-config" config
372369
"react-native-iphone-x-helper" (clj->js {:getStatusBarHeight (fn [])
373370
:getBottomSpace (fn [])})

src/quo/components/animated_header.cljs

+7-9
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
(:require [oops.core :refer [oget]]
33
[quo.animated :as animated]
44
[quo.components.header :as header]
5-
[quo.components.safe-area :as safe-area]
65
[quo.design-system.colors :as colors]
76
[quo.platform :as platform]
8-
[reagent.core :as reagent]))
7+
[reagent.core :as reagent]
8+
[react-native.safe-area :as safe-area]))
99

1010
(defn header-wrapper-style
1111
[{:keys [value offset]}]
@@ -95,11 +95,9 @@
9595
(defn header
9696
[{:keys [use-insets] :as props} & children]
9797
(if use-insets
98-
[safe-area/consumer
99-
(fn [insets]
100-
[header-container
101-
(-> props
102-
(dissoc :use-insets)
103-
(assoc :insets insets))
104-
children])]
98+
[header-container
99+
(-> props
100+
(dissoc :use-insets)
101+
(assoc :insets (safe-area/get-insets)))
102+
children]
105103
[header-container props children]))

src/quo/components/bottom_sheet/view.cljs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
(:require [cljs-bean.core :as bean]
33
[quo.animated :as animated]
44
[quo.components.bottom-sheet.style :as styles]
5-
[quo.components.safe-area :as safe-area]
65
[quo.design-system.colors :as colors]
76
[quo.gesture-handler :as gesture-handler]
87
[quo.platform :as platform]
98
[quo.react :as react]
109
[quo.react-native :as rn]
11-
[reagent.core :as reagent]))
10+
[reagent.core :as reagent]
11+
[react-native.safe-area :as safe-area]))
1212

1313
(def opacity-coeff 0.8)
1414
(def close-duration 150)
@@ -43,7 +43,7 @@
4343
(rn/use-keyboard)
4444
keyboard-height-android-delta
4545
(if (and platform/android? keyboard-shown) (+ keyboard-height 20) 0)
46-
safe-area (safe-area/use-safe-area)
46+
safe-area (safe-area/get-insets)
4747
window-height (- window-height
4848
(if platform/android?
4949
(+ 50 keyboard-height-android-delta) ;; TODO : remove 50 when

src/quo/components/safe_area.cljs

-23
This file was deleted.

src/quo/core.cljs

-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
[quo.components.list.header :as list-header]
99
[quo.components.list.index :as list-index]
1010
[quo.components.list.item :as list-item]
11-
[quo.components.safe-area :as safe-area]
1211
[quo.components.separator :as separator]
1312
[quo.components.text :as text]
1413
[quo.components.text-input :as text-input]
@@ -29,8 +28,5 @@
2928
(def switch controls/switch)
3029
(def radio controls/radio)
3130
(def checkbox controls/checkbox)
32-
(def safe-area-provider safe-area/provider)
33-
(def safe-area-consumer safe-area/consumer)
34-
(def safe-area-view safe-area/view)
3531
(def separator separator/separator)
3632
(def get-color colors/get-color)

src/quo2/components/animated_header_flatlist/view.cljs

+45-46
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
(reanimated/set-shared-value scroll-y current-y)))
3131

3232
(defn header
33-
[{:keys [theme-color display-picture-comp cover-uri title-comp]} top-inset scroll-y]
33+
[{:keys [theme-color f-display-picture-comp cover-uri title-comp]} top-inset scroll-y]
3434
(let [input-range [0 (* threshold 0.33)]
3535
picture-scale-down 0.4
3636
size-animation (interpolate scroll-y input-range [80 (* 80 picture-scale-down)])
@@ -48,50 +48,49 @@
4848
[reanimated/view {:style (style/header-bottom-part border-animation)}
4949
[title-comp]]
5050
[reanimated/view {:style (style/entity-picture size-animation)}
51-
[display-picture-comp image-animation]]]))
51+
[:f> f-display-picture-comp image-animation]]]))
52+
53+
(defn- f-animated-header-list
54+
[{:keys [header-comp main-comp back-button-on-press] :as params}]
55+
(let [window-height (:height (rn/get-window))
56+
{:keys [top bottom]} (safe-area/get-insets)
57+
;; view height calculation is different because window height is different on iOS and Android:
58+
view-height (if platform/ios?
59+
(- window-height bottom)
60+
(+ window-height top))
61+
initial-y (if platform/ios? (- top) 0)
62+
scroll-y (reanimated/use-shared-value initial-y)
63+
opacity-animation (interpolate scroll-y
64+
[(* threshold 0.33) (* threshold 0.66)]
65+
[0 1])
66+
translate-animation (interpolate scroll-y [(* threshold 0.66) threshold] [100 56])
67+
title-opacity-animation (interpolate scroll-y [(* threshold 0.66) threshold] [0 1])]
68+
[rn/view {:style (style/container-view view-height)}
69+
[rn/touchable-opacity
70+
{:active-opacity 1
71+
:on-press back-button-on-press
72+
:style (style/button-container {:left 20})}
73+
[quo/icon :i/arrow-left {:size 20 :color (colors/theme-colors colors/black colors/white)}]]
74+
[rn/touchable-opacity
75+
{:active-opacity 1
76+
:style (style/button-container {:right 20})}
77+
[quo/icon :i/options {:size 20 :color (colors/theme-colors colors/black colors/white)}]]
78+
[reanimated/blur-view
79+
{:blurAmount 32
80+
:blurType :light
81+
:overlayColor (if platform/ios? colors/white-opa-70 :transparent)
82+
:style (style/blur-view opacity-animation)}
83+
[reanimated/view {:style (style/header-comp translate-animation title-opacity-animation)}
84+
[header-comp]]]
85+
[reanimated/flat-list
86+
{:data [nil]
87+
:render-fn main-comp
88+
:key-fn str
89+
:header (reagent/as-element (header params top scroll-y))
90+
;; TODO: https://github.com/status-im/status-mobile/issues/14924
91+
:scroll-event-throttle 8
92+
:on-scroll (fn [event] (scroll-handler event initial-y scroll-y))}]]))
5293

5394
(defn animated-header-list
54-
[{:keys [header-comp main-comp back-button-on-press] :as parameters}]
55-
[safe-area/consumer
56-
(fn [insets]
57-
(let [window-height (:height (rn/get-window))
58-
status-bar-height (rn/status-bar-height)
59-
bottom-inset (:bottom insets)
60-
;; view height calculation is different because window height is different on iOS and Android:
61-
view-height (if platform/ios?
62-
(- window-height bottom-inset)
63-
(+ window-height status-bar-height))
64-
initial-y (if platform/ios? (- (:top insets)) 0)]
65-
[:f>
66-
(fn []
67-
(let [scroll-y (reanimated/use-shared-value initial-y)
68-
opacity-animation (interpolate scroll-y
69-
[(* threshold 0.33) (* threshold 0.66)]
70-
[0 1])
71-
translate-animation (interpolate scroll-y [(* threshold 0.66) threshold] [100 56])
72-
title-opacity-animation (interpolate scroll-y [(* threshold 0.66) threshold] [0 1])]
73-
[rn/view {:style (style/container-view view-height)}
74-
[rn/touchable-opacity
75-
{:active-opacity 1
76-
:on-press back-button-on-press
77-
:style (style/button-container {:left 20})}
78-
[quo/icon :i/arrow-left {:size 20 :color (colors/theme-colors colors/black colors/white)}]]
79-
[rn/touchable-opacity
80-
{:active-opacity 1
81-
:style (style/button-container {:right 20})}
82-
[quo/icon :i/options {:size 20 :color (colors/theme-colors colors/black colors/white)}]]
83-
[reanimated/blur-view
84-
{:blurAmount 32
85-
:blurType :light
86-
:overlayColor (if platform/ios? colors/white-opa-70 :transparent)
87-
:style (style/blur-view opacity-animation)}
88-
[reanimated/view {:style (style/header-comp translate-animation title-opacity-animation)}
89-
[header-comp]]]
90-
[reanimated/flat-list
91-
{:data [nil]
92-
:render-fn main-comp
93-
:key-fn str
94-
:header (reagent/as-element (header parameters (:top insets) scroll-y))
95-
;; TODO: https://github.com/status-im/status-mobile/issues/14924
96-
:scroll-event-throttle 8
97-
:on-scroll (fn [event] (scroll-handler event initial-y scroll-y))}]]))]))])
95+
[params]
96+
[:f> f-animated-header-list params])

src/quo2/components/code/snippet.cljs

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@
6565
18 ;; ~ 9 is char width, 18 is width used in Figma.
6666
(* 9 max-line-digits font-scale))))
6767

68-
(defn- native-renderer
68+
(defn- f-native-renderer
6969
[{:keys [rows max-lines on-copy-press]
7070
:or {max-lines ##Inf}}]
71-
(let [font-scale (:font-scale (rn/use-window-dimensions))
71+
(let [font-scale (:font-scale (rn/get-window))
7272
total-rows (count rows)
7373
number-rows-to-show (min (count rows) max-lines)
7474
line-number-width (calc-line-number-width font-scale number-rows-to-show)
@@ -100,7 +100,7 @@
100100
{:language language
101101
:renderer (fn [^js/Object props]
102102
(reagent/as-element
103-
[:f> native-renderer
103+
[:f> f-native-renderer
104104
{:rows (-> props .-rows bean/->clj)
105105
:on-copy-press #(when on-copy-press (on-copy-press children))
106106
:max-lines max-lines}]))

0 commit comments

Comments
 (0)