[fix #2903] fix arity bug on iOS

also use ListEmptyComponent prop for section-list
This commit is contained in:
Eric Dvorsak 2018-01-09 12:11:08 +01:00
parent 7685b43049
commit c99af08c4f
No known key found for this signature in database
GPG Key ID: 932AC1CE5F05DE0C
1 changed files with 10 additions and 13 deletions

View File

@ -5,8 +5,8 @@
(defn render [{:keys [title subtitle]}]
[item
[item-icon {:icon :dots_vertical_white}]
[item-content
[item-primary title]
[item-content
[item-primary title]
[item-secondary subtitle]]
[item-icon {:icon :arrow_right_gray}]])
@ -125,7 +125,7 @@
(defn flat-list
"A wrapper for FlatList.
See https://facebook.github.io/react-native/docs/flatlist.html"
[{:keys [data empty-component] :as props}]
[{:keys [data] :as props}]
{:pre [(or (nil? data)
(sequential? data))]}
[flat-list-class
@ -152,14 +152,11 @@
(defn section-list
"A wrapper for SectionList.
See https://facebook.github.io/react-native/docs/sectionlist.html"
[{:keys [sections empty-component render-section-header-fn] :as props
[{:keys [sections render-section-header-fn] :as props
:or {render-section-header-fn default-render-section-header}}]
(if (and (every? #(empty? (:data %)) sections) empty-component)
empty-component
[section-list-class
(merge (base-list-props props)
props
{:sections (clj->js (map wrap-per-section-render-fn sections))
:renderSectionHeader (wrap-render-section-header-fn render-section-header-fn)}
(when platform/ios? {:SectionSeparatorComponent (fn [] (reagent/as-element [section-separator]))}))]))
[section-list-class
(merge (base-list-props props)
props
{:sections (clj->js (map wrap-per-section-render-fn sections))
:renderSectionHeader (wrap-render-section-header-fn render-section-header-fn)}
(when platform/ios? {:SectionSeparatorComponent (fn [] (reagent/as-element section-separator))}))])