clean js/window first attempt
This commit is contained in:
parent
ab36ec7df7
commit
7694ad9e87
|
@ -1,7 +1,7 @@
|
|||
(ns status-im.components.action-button
|
||||
(:require [reagent.core :as r]))
|
||||
|
||||
(set! js/window.ActionButton (js/require "react-native-action-button"))
|
||||
(def class (js/require "react-native-action-button"))
|
||||
|
||||
(def action-button (r/adapt-react-class (.-default js/ActionButton)))
|
||||
(def action-button-item (r/adapt-react-class (.. js/ActionButton -default -Item)))
|
||||
(def action-button (r/adapt-react-class (.-default class)))
|
||||
(def action-button-item (r/adapt-react-class (.. class -default -Item)))
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
(ns status-im.components.icons.ionicons
|
||||
(:require [reagent.core :as r]))
|
||||
|
||||
(set! js/window.Ionicons (js/require "react-native-vector-icons/Ionicons"))
|
||||
|
||||
(def icon (r/adapt-react-class js/Ionicons))
|
||||
(def icon (r/adapt-react-class (js/require "react-native-vector-icons/Ionicons")))
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
(ns status-im.components.invertible-scroll-view)
|
||||
|
||||
(set! js/window.InvertibleScrollView (js/require "react-native-invertible-scroll-view"))
|
||||
(def class (js/require "react-native-invertible-scroll-view"))
|
||||
|
||||
(defn invertible-scroll-view [props]
|
||||
(js/React.createElement js/InvertibleScrollView
|
||||
(clj->js (merge {:inverted true} props))))
|
||||
(js/React.createElement class (clj->js (merge {:inverted true} props))))
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
(ns status-im.components.item-checkbox
|
||||
(:require [reagent.core :as r]))
|
||||
|
||||
(set! js/window.ItemCheckbox (js/require "react-native-circle-checkbox"))
|
||||
|
||||
(def item-checkbox (r/adapt-react-class js/ItemCheckbox))
|
||||
(def item-checkbox (r/adapt-react-class (js/require "react-native-circle-checkbox")))
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
(ns status-im.components.realm
|
||||
(:require [reagent.core :as r]))
|
||||
|
||||
(set! js/window.RealmReactNative (js/require "realm/react-native"))
|
||||
|
||||
(def list-view-class (r/adapt-react-class (.-ListView js/RealmReactNative)))
|
||||
|
||||
(defn list-view [props]
|
||||
[list-view-class (merge {:enableEmptySections true} props)])
|
|
@ -12,9 +12,7 @@
|
|||
color-purple
|
||||
text1-color
|
||||
text2-color
|
||||
toolbar-background1]]
|
||||
[status-im.components.realm :refer [list-view]]
|
||||
[reagent.core :as r]))
|
||||
toolbar-background1]]))
|
||||
|
||||
(defn toolbar [{:keys [title nav-action hide-nav? action custom-action
|
||||
background-color custom-content style]}]
|
||||
|
|
|
@ -2,22 +2,11 @@
|
|||
(:require
|
||||
[status-im.translations.en :as en]))
|
||||
|
||||
(set! js/window.I18n (js/require "react-native-i18n"))
|
||||
(set! (.-fallbacks js/I18n) true)
|
||||
(set! (.-defaultSeparator js/I18n) "/")
|
||||
(def i18n (js/require "react-native-i18n"))
|
||||
(set! (.-fallbacks i18n) true)
|
||||
(set! (.-defaultSeparator i18n) "/")
|
||||
|
||||
(set! (.-translations js.I18n) (clj->js {:en en/translations}))
|
||||
(set! (.-translations i18n) (clj->js {:en en/translations}))
|
||||
|
||||
(defn label [path & options]
|
||||
(.t js/I18n (name path) (clj->js options)))
|
||||
|
||||
(comment
|
||||
(defn deep-merge [& maps]
|
||||
(if (every? map? maps)
|
||||
(apply merge-with deep-merge maps)
|
||||
(last maps)))
|
||||
|
||||
(defn add-translations [new-translations]
|
||||
(let [translations (.-translations js/I18n)]
|
||||
(set! (.-translations js/I18n) (clj->js (deep-merge (js->clj translations) new-translations)))))
|
||||
)
|
||||
(.t i18n (name path) (clj->js options)))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
[clojure.string :as s])
|
||||
(:import goog.crypt.Sha256))
|
||||
|
||||
(set! js/window.RnRandomBytes (js/require "react-native-randombytes"))
|
||||
(def random-bytes (js/require "react-native-randombytes"))
|
||||
|
||||
(def sha-256 (Sha256.))
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
(byteArrayToHex (.digest sha-256)))
|
||||
|
||||
(defn gen-random-bytes [length cb]
|
||||
(.randomBytes js/window.RnRandomBytes length (fn [& [err buf]]
|
||||
(if err
|
||||
(cb {:error err})
|
||||
(cb {:buffer buf})))))
|
||||
(.randomBytes random-bytes length (fn [& [err buf]]
|
||||
(if err
|
||||
(cb {:error err})
|
||||
(cb {:buffer buf})))))
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
(ns status-im.utils.listview
|
||||
(:require-macros [natal-shell.data-source :refer [data-source]])
|
||||
(:require [status-im.components.realm]))
|
||||
(:require-macros [natal-shell.data-source :refer [data-source]]))
|
||||
|
||||
(defn clone-with-rows [ds rows]
|
||||
(.cloneWithRows ds (reduce (fn [ac el] (.push ac el) ac)
|
||||
|
|
Loading…
Reference in New Issue