File tree 18 files changed +81
-89
lines changed
navigation/bottom_nav_tab
contexts/syncing/scan_sync_code
18 files changed +81
-89
lines changed Original file line number Diff line number Diff line change 16
16
:align-self :center })
17
17
18
18
(def backdrop
19
- {:position :absolute
20
- :left 0
21
- :right 0
22
- :bottom 0
23
- :top 0
24
- :background-color colors/neutral-100})
19
+ {:position :absolute
20
+ :left 0
21
+ :right 0
22
+ :bottom 0
23
+ :top 0 })
24
+
25
+ (def backdrop-color
26
+ {:background-color colors/neutral-100})
25
27
26
28
(def container
27
29
{:position :absolute
Original file line number Diff line number Diff line change 207
207
[@show-bottom-sheet? @expanded? @gesture-running?])
208
208
209
209
[:<>
210
- [rn/touchable-without-feedback {:on-press (when backdrop-dismiss? close-bottom-sheet)}
210
+ [rn/pressable
211
+ {:on-press (when backdrop-dismiss? close-bottom-sheet)
212
+ :style styles/backdrop}
211
213
[reanimated/view
212
214
{:style (reanimated/apply-animations-to-style
213
215
{:opacity bg-opacity}
214
- styles/backdrop)}]]
216
+ styles/backdrop-color )}]]
215
217
(cond->> [reanimated/view
216
218
{:style (reanimated/apply-animations-to-style
217
219
{:transform [{:translateY translate-y}]}
Original file line number Diff line number Diff line change 1
1
(ns legacy.status-im.ui.components.keyboard-avoid-presentation
2
2
(:require
3
3
[legacy.status-im.ui.components.react :as react]
4
+ [react-native.utils :as rn.utils]
4
5
[reagent.core :as reagent]))
5
6
6
7
(defn keyboard-avoiding-view
7
- []
8
- (let [this (reagent/current-component )
9
- props (reagent/props this)
10
- children (reagent/children this)]
8
+ [& argv]
9
+ (let [[props children] (rn.utils/get-props-and-children argv)]
11
10
(reagent/as-element
12
11
(into [react/keyboard-avoiding-view
13
12
(update props
Original file line number Diff line number Diff line change 3
3
[legacy.status-im.ui.components.spacing :as spacing]
4
4
[legacy.status-im.ui.components.text :as text]
5
5
[react-native.core :as rn]
6
- [reagent.core :as reagent ]))
6
+ [react-native.utils :as rn.utils ]))
7
7
8
8
(defn footer
9
- []
10
- (let [this ( reagent/current-component )
9
+ [& argv ]
10
+ (let [[props children] ( rn.utils/get-props-and-children argv )
11
11
{:keys [color]
12
12
:or {color :secondary }}
13
- ( reagent/ props this) ]
13
+ props]
14
14
[rn/view
15
15
{:style (merge (:base spacing/padding-horizontal)
16
16
(:small spacing/padding-vertical))}
17
17
(into [text/text {:color color}]
18
- ( reagent/ children this) )]))
18
+ children)]))
Original file line number Diff line number Diff line change 3
3
[legacy.status-im.ui.components.spacing :as spacing]
4
4
[legacy.status-im.ui.components.text :as text]
5
5
[react-native.core :as rn]
6
- [reagent.core :as reagent ]))
6
+ [react-native.utils :as rn.utils ]))
7
7
8
8
(defn header
9
- []
10
- (let [this ( reagent/current-component )
9
+ [& argv ]
10
+ (let [[props children] ( rn.utils/get-props-and-children argv )
11
11
{:keys [color]
12
12
:or {color :secondary }}
13
- ( reagent/ props this) ]
13
+ props]
14
14
[rn/view
15
15
{:style (merge (:base spacing/padding-horizontal)
16
16
(:x-tiny spacing/padding-vertical))}
17
17
(into [text/text
18
18
{:color color
19
19
:style {:margin-top 10 }}]
20
- ( reagent/ children this) )]))
20
+ children)]))
Original file line number Diff line number Diff line change 3
3
[legacy.status-im.ui.components.colors :as colors]
4
4
[legacy.status-im.ui.components.typography :as typography]
5
5
[react-native.core :as rn]
6
- [reagent.core :as reagent ]))
6
+ [react-native.utils :as rn.utils ]))
7
7
8
8
(defn text-style
9
9
[{:keys [size align weight monospace color style]}]
40
40
style))
41
41
42
42
(defn text
43
- []
44
- (let [this (reagent/current-component )
45
- props (reagent/props this)
46
- component rn/text]
47
- (into [component
43
+ [& argv]
44
+ (let [[props children] (rn.utils/get-props-and-children argv)]
45
+ (into [rn/text
48
46
(merge {:style (text-style props)}
49
47
(dissoc props
50
48
:style
53
51
:color
54
52
:align
55
53
:animated? ))]
56
- ( reagent/ children this) )))
54
+ children)))
Original file line number Diff line number Diff line change 5
5
[react-native.platform :as platform]
6
6
[reagent.core :as reagent]))
7
7
8
-
9
8
(def cached-sources (js/Set. (js/Array. )))
10
9
11
10
(defn- caching-image
12
- [_ on-source-loaded]
13
- (let [this (reagent/current-component )]
14
- (reagent/create-class
15
- {:component-did-update
16
- (fn []
17
- (let [source (-> this reagent/props :source )]
18
- (when (oops/ocall cached-sources " has" source)
19
- (on-source-loaded source))))
20
- :reagent-render
21
- (fn [{:keys [source] :as props}]
22
- [rn/image
23
- (assoc props
24
- ; ; hide the cache image under the real one
25
- ; ; have to render it for the on-load event
26
- :style {:width 1
27
- :height 1
28
- :left " 50%"
29
- :top " 50%"
30
- :position :absolute }
31
- :on-load
32
- (fn [_]
33
- (when-not (oops/ocall cached-sources " has" source)
34
- (oops/ocall cached-sources " add" source)
35
- (on-source-loaded source)))
36
- :on-error js/console.error)])})))
11
+ [{:keys [source]} on-source-loaded]
12
+ (reagent/create-class
13
+ {:component-did-update
14
+ (fn []
15
+ (when (oops/ocall cached-sources " has" source)
16
+ (on-source-loaded source)))
17
+ :reagent-render
18
+ (fn [{:keys [source] :as props}]
19
+ [rn/image
20
+ (assoc props
21
+ ; ; hide the cache image under the real one
22
+ ; ; have to render it for the on-load event
23
+ :style {:width 1
24
+ :height 1
25
+ :left " 50%"
26
+ :top " 50%"
27
+ :position :absolute }
28
+ :on-load
29
+ (fn [_]
30
+ (when-not (oops/ocall cached-sources " has" source)
31
+ (oops/ocall cached-sources " add" source)
32
+ (on-source-loaded source)))
33
+ :on-error js/console.error)])}))
37
34
38
35
(defn image
39
36
" Same as rn/image but cache the image source in a js/Set, so the image won't
Original file line number Diff line number Diff line change 4
4
[quo.foundations.typography :as typography]
5
5
[quo.theme :as quo.theme]
6
6
[react-native.core :as rn]
7
- [reagent.core :as reagent ]))
7
+ [react-native.utils :as rn.utils ]))
8
8
9
9
(defn text-style
10
10
[{:keys [size align weight style theme]}]
41
41
(def ^:private text-view (quo.theme/with-theme text-view-internal))
42
42
43
43
(defn text
44
- []
45
- (let [this (reagent/current-component )
46
- props (reagent/props this)
47
- children (reagent/children this)]
44
+ [& argv]
45
+ (let [[props children] (rn.utils/get-props-and-children argv)]
48
46
(into [text-view props] children)))
Original file line number Diff line number Diff line change 46
46
{:width 90
47
47
:height 40
48
48
:border-radius 10 })]
49
- [rn/touchable-without-feedback
49
+ [rn/pressable
50
50
{:test-ID test-ID
51
51
:allow-multiple-presses? true
52
52
:on-press on-press
Original file line number Diff line number Diff line change 42
42
[0 total-amount]
43
43
[0 total-width])
44
44
width->amount #(/ (* % total-amount) total-width)]
45
- [rn/touchable-without-feedback
45
+ [rn/pressable
46
46
{:on-press (fn []
47
47
(when (and (not @detecting-gesture?) allow-press?)
48
48
(on-press )
Original file line number Diff line number Diff line change 53
53
(into [touchable-highlight-class (utils/custom-pressable-props props)] children))
54
54
55
55
(defn touchable-without-feedback
56
- [props & children]
57
- (into [touchable-without-feedback-class (utils/custom-pressable-props props)] children))
56
+ {:deprecated " pressable should be used instead" }
57
+ [props child]
58
+ [touchable-without-feedback-class (utils/custom-pressable-props props) child])
58
59
59
60
(def flat-list flat-list /flat-list )
60
61
Original file line number Diff line number Diff line change 22
22
useAnimatedScrollHandler
23
23
runOnJS)]
24
24
[" react-native-redash" :refer (withPause )]
25
- [oops.core :as oops]
26
25
[react-native.flat-list :as rn-flat-list]
26
+ [react-native.utils :as rn.utils]
27
27
[reagent.core :as reagent]
28
28
[utils.transforms :as transforms]
29
29
[utils.worklets.core :as worklets.core]))
43
43
(def ^:private view* (reagent/adapt-react-class (.-View reanimated)))
44
44
45
45
(defn view
46
- []
47
- (let [current-component (reagent/current-component )
48
- reagent-props (reagent/props current-component)
49
- children (reagent/children current-component)
50
- updated-props (update reagent-props :style transforms/styles-with-vectors)
51
- ; ; Some components add JS props to their children (such as TouchableWithoutFeedback), to make
52
- ; ; this component fully compatible we are passing those props to the inner component (`view*`).
53
- external-props (oops/gobj-get current-component " props" )
54
- all-props (transforms/copy-js-obj-to-map external-props updated-props #(not= % " argv" ))]
55
- (into [view* all-props] children)))
46
+ [& argv]
47
+ (let [[reagent-props children] (rn.utils/get-props-and-children argv)
48
+ updated-props (update reagent-props :style transforms/styles-with-vectors)]
49
+ (into [view* updated-props] children)))
56
50
57
51
(def text (reagent/adapt-react-class (.-Text reanimated)))
58
52
(def scroll-view (reagent/adapt-react-class (.-ScrollView reanimated)))
Original file line number Diff line number Diff line change 30
30
on-press
31
31
(assoc :on-press (throttled-on-press props throttle-id)
32
32
:ref (wrapped-ref props throttle-id)))))
33
+
34
+ (defn get-props-and-children
35
+ [argv]
36
+ (let [first-child (first argv)
37
+ props (when (map? first-child) first-child)
38
+ children (if props (rest argv) argv)]
39
+ [props children]))
Original file line number Diff line number Diff line change 94
94
true ))
95
95
[rn/view {:style {:flex 1 }}
96
96
; ; backdrop
97
- [rn/touchable-without-feedback {:on-press #(rf/dispatch [:hide-bottom-sheet ])}
97
+ [rn/pressable
98
+ {:on-press #(rf/dispatch [:hide-bottom-sheet ])
99
+ :style {:flex 1 }}
98
100
[reanimated/view
99
101
{:style (reanimated/apply-animations-to-style
100
102
{:opacity bg-opacity}
Original file line number Diff line number Diff line change 203
203
204
204
(defn- f-bottom-view
205
205
[insets translate-y]
206
- [rn/touchable-without-feedback
206
+ [rn/pressable
207
207
{:on-press #(js/alert " Yet to be implemented" )}
208
208
[reanimated/view
209
209
{:style (style/bottom-container translate-y (:bottom insets))}
Original file line number Diff line number Diff line change 12
12
[react-native.core :as rn]
13
13
[react-native.platform :as platform]
14
14
[react-native.shake :as react-native-shake]
15
+ [reagent.core]
15
16
[reagent.impl.batching :as batching]
16
17
[status-im.common.log :as logging]
17
18
[taoensso.timbre :as log]
32
33
; ;;; re-frame RN setup
33
34
(set! interop/next-tick js/setTimeout)
34
35
(set! batching/fake-raf #(js/setTimeout % 0 ))
36
+ (def functional-compiler (reagent.core/create-compiler {:function-components true }))
37
+ (reagent.core/set-default-compiler! functional-compiler)
35
38
36
39
(def adjust-resize 16 )
37
40
Original file line number Diff line number Diff line change 49
49
(map? x) (reduce-kv convert-keys-and-values #js {} x)
50
50
(vector? x) (to-array (mapv styles-with-vectors x))
51
51
:else (clj->js x)))
52
-
53
- (defn copy-js-obj-to-map
54
- " Copy `obj` keys and values into `m` if `(pred obj-key)` is satisfied."
55
- [obj m pred]
56
- (persistent!
57
- (reduce (fn [acc js-prop]
58
- (if (pred js-prop)
59
- (assoc! acc js-prop (oops/gobj-get obj js-prop))
60
- acc))
61
- (transient m)
62
- (js-keys obj))))
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ def click(self, times_to_click=3):
41
41
class UnreadMessagesCountText (Text ):
42
42
def __init__ (self , driver , parent_locator : str ):
43
43
super ().__init__ (driver ,
44
- xpath = "%s/*[@resource-id='counter-component']/android.widget.TextView" % parent_locator )
44
+ xpath = "%s// *[@resource-id='counter-component']/android.widget.TextView" % parent_locator )
45
45
46
46
47
47
class TabButton (Button ):
You can’t perform that action at this time.
0 commit comments