react-native-boxes 1.4.58 → 1.4.60

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Modal.tsx +27 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-boxes",
3
- "version": "1.4.58",
3
+ "version": "1.4.60",
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/Modal.tsx CHANGED
@@ -132,7 +132,7 @@ export const BottomSheet = (props: BottomSheetProps) => {
132
132
  <Subtitle style={{
133
133
  fontFamily: theme.fonts.Bold
134
134
  }}>{props.title.toString()}</Subtitle>
135
- ) : <>{props.title}</>
135
+ ) : (props.title as any)
136
136
  }
137
137
  {
138
138
  cancellable ? (<TouchableOpacity
@@ -152,7 +152,7 @@ export const BottomSheet = (props: BottomSheetProps) => {
152
152
  width: '100%'
153
153
  }}>
154
154
  {
155
- props.swipeToCloseDisabled ? (
155
+ props.swipeToCloseDisabled && isWeb() ? (
156
156
  <ScrollView
157
157
  nestedScrollEnabled={true}
158
158
  showsVerticalScrollIndicator={false}
@@ -383,6 +383,7 @@ export type DropDownViewProps = {
383
383
  initialVisile?: Boolean,
384
384
  title?: string,
385
385
  displayType?: 'button' | 'input',
386
+ onRenderList?: (opt: DropDownViewOption[], onSelect: (selectedId: string, opt: DropDownViewOption) => void) => any,
386
387
  onRenderOption?: (opt: DropDownViewOption, setSelected: (selectedId: string, opt: DropDownViewOption) => void) => any,
387
388
  onEmptyListPlaceholder?: (dismiss?: () => void) => React.ReactNode
388
389
  forceDialogSelectOnWeb?: Boolean
@@ -552,24 +553,31 @@ export const DropDownView = (props: DropDownViewProps) => {
552
553
  :
553
554
  (
554
555
 
555
- props.options.map((opt, idx) => {
556
- if (props.onRenderOption) {
557
- return props.onRenderOption(opt, onSelect)
558
- }
559
- return (
560
- <TertiaryButtonView
561
- onPress={() => {
562
- setVisible(false)
563
- props.onSelect(opt.id, opt)
564
- }}
565
- style={{
566
- padding: 0,
567
- paddingBottom: idx == props.options.length - 1 ? theme.dimens.space.md : 0,
568
- paddingTop: idx == 0 ? theme.dimens.space.md : 0,
569
- }}
570
- key={opt.id} >{opt.title || opt.value}</TertiaryButtonView>
556
+ props.onRenderList ?
557
+ props.onRenderList(props.options, (selectedId: string, opt: DropDownViewOption) => {
558
+ setVisible(false)
559
+ props.onSelect(selectedId, opt)
560
+ }) :
561
+ (
562
+ props.options.map((opt, idx) => {
563
+ if (props.onRenderOption) {
564
+ return props.onRenderOption(opt, onSelect)
565
+ }
566
+ return (
567
+ <TertiaryButtonView
568
+ onPress={() => {
569
+ setVisible(false)
570
+ props.onSelect(opt.id, opt)
571
+ }}
572
+ style={{
573
+ padding: 0,
574
+ paddingBottom: idx == props.options.length - 1 ? theme.dimens.space.md : 0,
575
+ paddingTop: idx == 0 ? theme.dimens.space.md : 0,
576
+ }}
577
+ key={opt.id} >{opt.title || opt.value}</TertiaryButtonView>
578
+ )
579
+ })
571
580
  )
572
- })
573
581
  )
574
582
 
575
583
  }