[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

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