react-native-boxes 1.4.73 → 1.4.75

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-boxes",
3
- "version": "1.4.73",
3
+ "version": "1.4.75",
4
4
  "description": "A react native library for rapid development of UI using boxes",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/List.tsx CHANGED
@@ -5,16 +5,20 @@ import { Caption, Subtitle, TextView, TitleText } from "./Text"
5
5
  import { useContext } from "react"
6
6
  import { ThemeContext } from "./ThemeContext"
7
7
  import { PressableView } from "./Button"
8
-
8
+ import React from 'react'
9
9
 
10
10
  export type DatatableViewProps = {
11
11
  items: any[],
12
- itemAdapter: (item: any, idx: number, list: any) => SimpleDatatableViewItemProps,
12
+ itemAdapter?: (item: any, idx: number, list: any) => SimpleDatatableViewItemProps,
13
13
  loading?: boolean,
14
+ onRender?: (item: any, idx: number, list: any) => React.Component | React.JSX.Element | Element | any
14
15
  } & ViewProps
15
16
  export function SimpleDatalistView(props: DatatableViewProps) {
16
17
  const theme = useContext(ThemeContext)
17
-
18
+ if (!props.itemAdapter && !props.onRender) {
19
+ console.warn('SimpleDatalistView: must provide either itemAdapter or onRender')
20
+ return null
21
+ }
18
22
  return props.loading ?
19
23
  <Center style={{
20
24
  padding: theme.dimens.space.xl * 2
@@ -26,7 +30,10 @@ export function SimpleDatalistView(props: DatatableViewProps) {
26
30
  <VBox style={[props.style]}>
27
31
  {
28
32
  props.items.map((item, idx) => {
29
- let data = props.itemAdapter(item, idx, props.items)
33
+ if (props.onRender) {
34
+ return props.onRender?.(item, idx, props.items)
35
+ }
36
+ let data = props.itemAdapter?.(item, idx, props.items)
30
37
  return (
31
38
  <SimpleDatatlistViewItem
32
39
  key={idx}
@@ -39,6 +46,7 @@ export function SimpleDatalistView(props: DatatableViewProps) {
39
46
 
40
47
  }
41
48
 
49
+
42
50
  export type SimpleDatatableViewItemProps = {
43
51
  title?: string,
44
52
  icon?: string | any,
package/src/Modal.tsx CHANGED
@@ -35,7 +35,8 @@ export const BottomSheet = (props: BottomSheetProps) => {
35
35
  const theme = useContext(ThemeContext)
36
36
  let cancellable = props.cancellable != undefined ?
37
37
  props.cancellable : true
38
-
38
+ let swipeToCloseDisabled = props.swipeToCloseDisabled != undefined ?
39
+ props.swipeToCloseDisabled : false
39
40
  useEffect(() => {
40
41
  setModalVisible(props.visible)
41
42
  if (props.visible)
@@ -58,7 +59,7 @@ export const BottomSheet = (props: BottomSheetProps) => {
58
59
  props.onDismiss && props.onDismiss()
59
60
  })
60
61
 
61
- const Wrapper = props.swipeToCloseDisabled ? ({ children }: any) => {
62
+ const Wrapper = swipeToCloseDisabled ? ({ children }: any) => {
62
63
  return (
63
64
  <View style={[styles.modalContainer, {
64
65
  backgroundColor: props.backgroundColor || theme.colors.forground