fixed share dialog everywhere on iOS
This commit is contained in:
parent
6ca2f61eb3
commit
141246e8d5
|
@ -167,7 +167,7 @@
|
|||
(defn show-dialog [{:keys [title options callback]}]
|
||||
(let [dialog (new react-native-dialogs)]
|
||||
(.set dialog (clj->js {:title title
|
||||
:items options
|
||||
:items (mapv :text options)
|
||||
:itemsCallback callback}))
|
||||
(.show dialog)))
|
||||
|
||||
|
|
|
@ -27,13 +27,11 @@
|
|||
(def list-selection-fn (:list-selection-fn platform-specific))
|
||||
|
||||
(defn open-ios-menu [options]
|
||||
(let [cancel-option {:text (label :t/cancel)}
|
||||
options (conj options cancel-option)]
|
||||
(list-selection-fn {:options options
|
||||
:callback (fn [index]
|
||||
(when (< index (count options))
|
||||
(when-let [handler (:value (nth options index))]
|
||||
(handler))))}))
|
||||
(list-selection-fn {:options options
|
||||
:callback (fn [index]
|
||||
(when (< index (count options))
|
||||
(when-let [handler (:value (nth options index))]
|
||||
(handler))))})
|
||||
nil)
|
||||
|
||||
(defn context-menu [trigger options]
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
(defn share [text dialog-title]
|
||||
(let [list-selection-fn (:list-selection-fn platform-specific)]
|
||||
(list-selection-fn {:title dialog-title
|
||||
:options [(label :t/sharing-copy-to-clipboard) (label :t/sharing-share)]
|
||||
:options (share-options text)
|
||||
:callback (fn [index]
|
||||
(case index
|
||||
0 (copy-to-clipboard text)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
(ns status-im.ios.platform
|
||||
(:require [status-im.components.styles :as styles]
|
||||
[status-im.i18n :refer [label]]
|
||||
[status-im.utils.utils :as utils]))
|
||||
|
||||
(def component-styles
|
||||
|
@ -194,9 +195,11 @@
|
|||
(def react-native (js/require "react-native"))
|
||||
|
||||
(defn action-sheet-options [options]
|
||||
(let [destructive-opt-index (utils/first-index :destructive? options)]
|
||||
(let [destructive-opt-index (utils/first-index :destructive? options)
|
||||
cancel-option {:text (label :t/cancel)}
|
||||
options (conj options cancel-option)]
|
||||
(clj->js (merge {:options (mapv :text options)
|
||||
:cancelButtonIndex (count options)}
|
||||
:cancelButtonIndex (dec (count options))}
|
||||
(when destructive-opt-index {:destructiveButtonIndex destructive-opt-index})))))
|
||||
|
||||
(defn show-action-sheet [{:keys [options callback]}]
|
||||
|
|
Loading…
Reference in New Issue