react-native-boxes 1.4.30 → 1.4.31

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 +15 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-boxes",
3
- "version": "1.4.30",
3
+ "version": "1.4.31",
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
@@ -364,20 +364,20 @@ export function Expand(props: ViewProps & {
364
364
  );
365
365
  }
366
366
 
367
+
367
368
  export type DropDownViewOption = {
368
369
  id: string
369
370
  value: any
370
371
  title?: string
371
372
  }
372
-
373
373
  export type DropDownViewProps = {
374
+ listType?: 'sheet' | 'horizontal-list'
374
375
  options: DropDownViewOption[]
375
376
  selectedId: string,
376
377
  onSelect: (selectedId: string, opt: DropDownViewOption) => void
377
378
 
378
379
  initialVisile?: Boolean,
379
380
  title?: string,
380
- listType?: 'sheet' | 'horizontal-list'
381
381
  displayType?: 'button' | 'input',
382
382
  onRenderOption?: (opt: DropDownViewOption) => any,
383
383
  forceDialogSelectOnWeb?: Boolean
@@ -393,6 +393,7 @@ export const DropDownView = (props: DropDownViewProps) => {
393
393
  const displayType = props.displayType || 'input'
394
394
  const theme = useContext(ThemeContext)
395
395
  const [visible, setVisible] = useState(props.initialVisile || false)
396
+ const flatlistRef = useRef<FlatList<any>>()
396
397
 
397
398
  const getSelected = (): DropDownViewOption | undefined => {
398
399
  let se = props.options.find(op => op.id == props.selectedId)
@@ -437,6 +438,12 @@ export const DropDownView = (props: DropDownViewProps) => {
437
438
  {
438
439
  (visible && props.listType == 'horizontal-list') ? (
439
440
  <FlatList
441
+ style={[{
442
+ marginTop: theme.dimens.space.sm,
443
+ marginBottom: theme.dimens.space.sm,
444
+ }, props.style]}
445
+ //@ts-ignore
446
+ ref={flatlistRef}
440
447
  ItemSeparatorComponent={() => {
441
448
  return (
442
449
  <View
@@ -459,13 +466,15 @@ export const DropDownView = (props: DropDownViewProps) => {
459
466
  return (
460
467
  <PressableView
461
468
  onPress={() => {
469
+ setVisible(false)
462
470
  props.onSelect(opt.id, opt)
463
471
  }}>
464
472
  <Center style={{
473
+ borderWidth: 1,
465
474
  borderRadius: theme.dimens.space.md,
466
- width: theme.dimens.space.xl * 1.5,
467
- height: theme.dimens.space.xl * 1.5,
468
- backgroundColor: props.selectedId == opt?.id ?
475
+ width: theme.dimens.space.xl * 1.4,
476
+ height: theme.dimens.space.xl * 1.4,
477
+ borderColor: props.selectedId == opt?.id ?
469
478
  theme.colors.accent : theme.colors.background,
470
479
  padding: theme.dimens.space.md
471
480
  }}>
@@ -564,6 +573,7 @@ export const DropDownView = (props: DropDownViewProps) => {
564
573
 
565
574
 
566
575
 
576
+
567
577
  export type ConfirmationDialogProps = {
568
578
  visible: boolean,
569
579
  title?: string | React.Component,