react-native-boxes 1.4.31 → 1.4.32

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 +8 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-boxes",
3
- "version": "1.4.31",
3
+ "version": "1.4.32",
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
@@ -379,7 +379,7 @@ export type DropDownViewProps = {
379
379
  initialVisile?: Boolean,
380
380
  title?: string,
381
381
  displayType?: 'button' | 'input',
382
- onRenderOption?: (opt: DropDownViewOption) => any,
382
+ onRenderOption?: (opt: DropDownViewOption, setSelected?: (selectedId: string, opt: DropDownViewOption) => void) => any,
383
383
  forceDialogSelectOnWeb?: Boolean
384
384
  swipeToCloseDisabled?: boolean
385
385
  } & CompositeTextInputViewProps
@@ -399,6 +399,10 @@ export const DropDownView = (props: DropDownViewProps) => {
399
399
  let se = props.options.find(op => op.id == props.selectedId)
400
400
  return se
401
401
  };
402
+ const onSelect = (selectedId: string, opt: DropDownViewOption) => {
403
+ props.onSelect(selectedId, opt)
404
+ setVisible(false)
405
+ }
402
406
  const shouldShowLabel = props.listType == 'horizontal-list' ? !visible : true
403
407
  if (Platform.OS == 'web' && !props.forceDialogSelectOnWeb) {
404
408
  return (
@@ -417,7 +421,7 @@ export const DropDownView = (props: DropDownViewProps) => {
417
421
  {
418
422
  props.options.map(opt => {
419
423
  if (props.onRenderOption) {
420
- return props.onRenderOption(opt)
424
+ return props.onRenderOption(opt, onSelect)
421
425
  }
422
426
  return (
423
427
  <option
@@ -461,7 +465,7 @@ export const DropDownView = (props: DropDownViewProps) => {
461
465
  renderItem={(item) => {
462
466
  const opt = item.item
463
467
  if (props.onRenderOption) {
464
- return props.onRenderOption(opt)
468
+ return props.onRenderOption(opt, onSelect)
465
469
  }
466
470
  return (
467
471
  <PressableView
@@ -502,7 +506,7 @@ export const DropDownView = (props: DropDownViewProps) => {
502
506
  {
503
507
  props.options.map((opt, idx) => {
504
508
  if (props.onRenderOption) {
505
- return props.onRenderOption(opt)
509
+ return props.onRenderOption(opt, onSelect)
506
510
  }
507
511
  return (
508
512
  <TertiaryButtonView
@@ -572,8 +576,6 @@ export const DropDownView = (props: DropDownViewProps) => {
572
576
  }
573
577
 
574
578
 
575
-
576
-
577
579
  export type ConfirmationDialogProps = {
578
580
  visible: boolean,
579
581
  title?: string | React.Component,