@marktiderman/genesis-ui-native 3.2.0 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -602,8 +602,13 @@ interface NativeRecordViewProps<T extends Row = Row> {
602
602
  onSaved?: (row: T) => void;
603
603
  /** Above the sections: a switcher between records. */
604
604
  switcher?: ReactNode;
605
- /** The screen's own sections, by id. */
606
- slots?: Partial<Record<string, ReactNode>>;
605
+ /**
606
+ * The screen's own sections, by id. A node is laid out in the screen's scroll view. A section
607
+ * that scrolls itself (a long FlatList) passes a function instead: it gets the screen's top
608
+ * (switcher, readiness, sections) to render as its list's header, and owns the scroll view, so
609
+ * set `contentInsetAdjustmentBehavior="automatic"` on it.
610
+ */
611
+ slots?: Partial<Record<string, ReactNode | ((top: ReactNode) => ReactNode)>>;
607
612
  /** More props for a list section's NativeResourceView, by section id. */
608
613
  lists?: Partial<Record<string, Partial<Omit<NativeResourceViewProps, "view" | "filter">>>>;
609
614
  messages?: Partial<NativeRecordViewMessages>;
@@ -2081,10 +2081,6 @@ function NativeRecordView(props) {
2081
2081
  }
2082
2082
  ) : null
2083
2083
  ] });
2084
- let body = null;
2085
- if (many && !active) {
2086
- body = /* @__PURE__ */ jsx(ScrollView, { contentContainerStyle: { padding: 16 }, children: /* @__PURE__ */ jsx(Group, { testID: `${testID}-sections`, children: sections.map((s, i) => /* @__PURE__ */ jsx(Cell, { last: i === sections.length - 1, children: /* @__PURE__ */ jsx(NativeListItem, { testID: `${testID}-section-${s.id}`, title: s.label, showChevron: true, onPress: () => choose(s.id), className: "bg-transparent" }) }, s.id)) }) });
2087
- }
2088
2084
  const back = many && local !== void 0 && section === void 0 ? /* @__PURE__ */ jsx(View, { style: { paddingHorizontal: 16, paddingTop: 8 }, children: /* @__PURE__ */ jsx(Group, { testID: `${testID}-back`, children: /* @__PURE__ */ jsx(Cell, { last: true, children: /* @__PURE__ */ jsx(
2089
2085
  NativeListItem,
2090
2086
  {
@@ -2095,42 +2091,71 @@ function NativeRecordView(props) {
2095
2091
  className: "bg-transparent"
2096
2092
  }
2097
2093
  ) }) }) }) : null;
2098
- if (active?.kind === "list") {
2099
- body = /* @__PURE__ */ jsx(
2094
+ const scroll = (content) => /* @__PURE__ */ jsxs(
2095
+ ScrollView,
2096
+ {
2097
+ testID: `${testID}-scroll`,
2098
+ contentInsetAdjustmentBehavior: "automatic",
2099
+ keyboardShouldPersistTaps: "handled",
2100
+ contentContainerStyle: { flexGrow: 1, paddingBottom: 16 },
2101
+ children: [
2102
+ top,
2103
+ back,
2104
+ content
2105
+ ]
2106
+ }
2107
+ );
2108
+ let screen;
2109
+ if (many && !active) {
2110
+ screen = scroll(
2111
+ /* @__PURE__ */ jsx(View, { style: { padding: 16 }, children: /* @__PURE__ */ jsx(Group, { testID: `${testID}-sections`, children: sections.map((s, i) => /* @__PURE__ */ jsx(Cell, { last: i === sections.length - 1, children: /* @__PURE__ */ jsx(NativeListItem, { testID: `${testID}-section-${s.id}`, title: s.label, showChevron: true, onPress: () => choose(s.id), className: "bg-transparent" }) }, s.id)) }) })
2112
+ );
2113
+ } else if (active?.kind === "list") {
2114
+ const more = lists?.[active.id];
2115
+ screen = /* @__PURE__ */ jsx(
2100
2116
  NativeResourceView,
2101
2117
  {
2102
2118
  view: active.view,
2103
2119
  testID: `${testID}-list`,
2104
- ...lists?.[active.id],
2120
+ ...more,
2121
+ header: /* @__PURE__ */ jsxs(Fragment, { children: [
2122
+ top,
2123
+ back,
2124
+ more?.header
2125
+ ] }),
2105
2126
  title: false,
2106
2127
  filter: recordView.listFilter(active.id, record)
2107
2128
  },
2108
2129
  active.id
2109
2130
  );
2110
2131
  } else if (active?.kind === "settings") {
2111
- body = /* @__PURE__ */ jsx(ScrollView, { contentContainerStyle: { padding: 16 }, keyboardShouldPersistTaps: "handled", children: /* @__PURE__ */ jsx(
2112
- SettingsGroup,
2113
- {
2114
- recordView,
2115
- sectionId: active.id,
2116
- row: record,
2117
- words,
2118
- onSaved: (saved) => {
2119
- void queryClient.invalidateQueries({ queryKey: [...resourceKeys(recordView.view.resource).all] });
2120
- onSaved?.(saved);
2132
+ screen = scroll(
2133
+ /* @__PURE__ */ jsx(View, { style: { padding: 16 }, children: /* @__PURE__ */ jsx(
2134
+ SettingsGroup,
2135
+ {
2136
+ recordView,
2137
+ sectionId: active.id,
2138
+ row: record,
2139
+ words,
2140
+ onSaved: (saved) => {
2141
+ void queryClient.invalidateQueries({ queryKey: [...resourceKeys(recordView.view.resource).all] });
2142
+ onSaved?.(saved);
2143
+ },
2144
+ testID: `${testID}-settings`
2121
2145
  },
2122
- testID: `${testID}-settings`
2123
- },
2124
- `${String(recordView.recordId(record))}:${active.id}`
2125
- ) });
2126
- } else if (active) {
2127
- body = slots?.[active.id] ?? null;
2146
+ `${String(recordView.recordId(record))}:${active.id}`
2147
+ ) })
2148
+ );
2149
+ } else {
2150
+ const slot = active ? slots?.[active.id] : void 0;
2151
+ screen = typeof slot === "function" ? slot(
2152
+ /* @__PURE__ */ jsxs(Fragment, { children: [
2153
+ top,
2154
+ back
2155
+ ] })
2156
+ ) : scroll(slot ?? null);
2128
2157
  }
2129
- return /* @__PURE__ */ jsxs(View, { testID, style: { flex: 1, backgroundColor: colors.groupedBackground }, children: [
2130
- top,
2131
- back,
2132
- /* @__PURE__ */ jsx(View, { style: { flex: 1 }, children: body })
2133
- ] });
2158
+ return /* @__PURE__ */ jsx(View, { testID, style: { flex: 1, backgroundColor: colors.groupedBackground }, children: screen });
2134
2159
  }
2135
2160
  function SettingsGroup({
2136
2161
  recordView,