ordering-ui-react-native 0.21.8-release → 0.21.9-release

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": "ordering-ui-react-native",
3
- "version": "0.21.08-release",
3
+ "version": "0.21.09-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,16 +1,32 @@
1
1
  import React from 'react';
2
2
  import DatePicker from 'react-native-date-picker'
3
3
  import { DateContainer } from './styles';
4
+ import { useLanguage } from 'ordering-components/native';
4
5
 
5
6
  export const DatePickerUI = (props: any) => {
6
7
  const {
7
8
  birthdate,
8
- handleChangeDate
9
+ onConfirm,
10
+ onCancel,
11
+ open,
9
12
  } = props;
10
13
 
14
+ const [, t] = useLanguage();
15
+
11
16
  return (
12
17
  <DateContainer>
13
- <DatePicker mode="date" date={birthdate ? new Date(birthdate) : new Date()} onDateChange={handleChangeDate} />
18
+ <DatePicker
19
+ modal
20
+ mode="date"
21
+ open={open}
22
+ title={t('SELECT_A_DATE', 'Select a date')}
23
+ confirmText={t('CONFIRM', 'Confirm')}
24
+ cancelText={t('CANCEL', 'Cancel')}
25
+ date={birthdate ? new Date(birthdate) : new Date()}
26
+ onConfirm={date => onConfirm(date)}
27
+ onCancel={onCancel}
28
+ maximumDate={new Date()}
29
+ />
14
30
  </DateContainer>
15
31
  );
16
32
  };
@@ -5,7 +5,7 @@ import { useTheme } from 'styled-components/native';
5
5
  import { useForm, Controller } from 'react-hook-form';
6
6
  import { SignupForm } from '../SignupForm'
7
7
 
8
- import { UDForm, UDLoader, UDWrapper, WrapperPhone } from './styles';
8
+ import { UDForm, UDLoader, UDWrapper, WrapperPhone, WrapperBirthdate } from './styles';
9
9
 
10
10
  import { OText, OButton, OInput, OModal, OIcon } from '../shared';
11
11
  import { OAlert } from '../../../../../src/components/shared'
@@ -380,19 +380,17 @@ export const UserFormDetailsUI = (props: any) => {
380
380
  ),
381
381
  )}
382
382
  {showInputBirthday && (
383
- <WrapperPhone>
383
+ <WrapperBirthdate>
384
384
  <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
385
385
  {t('BIRTHDATE', 'Birthdate')}
386
386
  </OText>
387
387
  <TouchableOpacity onPress={() => setShowDatePicker(!showDatePicker)}>
388
- <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ alignSelf: 'flex-start' }}>
388
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ marginTop: 6, marginBottom: -15 }}>
389
389
  {birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
390
390
  </OText>
391
391
  </TouchableOpacity>
392
- {showDatePicker && (
393
- <DatePickerUI birthdate={birthdate} handleChangeDate={_handleChangeDate} />
394
- )}
395
- </WrapperPhone>
392
+ <DatePickerUI open={showDatePicker} birthdate={birthdate} onConfirm={_handleChangeDate} onCancel={() => setShowDatePicker(false)} />
393
+ </WrapperBirthdate>
396
394
  )}
397
395
  {!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
398
396
  <WrapperPhone>
@@ -503,9 +501,9 @@ export const UserFormDetailsUI = (props: any) => {
503
501
  : t('CONTINUE', 'Continue'))
504
502
  }
505
503
  bgColor={theme.colors.primary}
506
- textStyle={{
507
- color: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.primary : theme.colors.white,
508
- fontSize: 14
504
+ textStyle={{
505
+ color: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.primary : theme.colors.white,
506
+ fontSize: 14
509
507
  }}
510
508
  borderColor={theme.colors.primary}
511
509
  isDisabled={!user?.guest_id && (formState.loading || !isValid)}
@@ -32,3 +32,10 @@ export const WrapperPhone = styled.View`
32
32
  border-bottom-width: 1px;
33
33
  border-bottom-color: ${(props: any) => props.theme.colors.border};
34
34
  `
35
+
36
+ export const WrapperBirthdate = styled.View`
37
+ margin-bottom: 25px;
38
+ width: 100%;
39
+ border-bottom-width: 1px;
40
+ border-bottom-color: ${(props: any) => props.theme.colors.border};
41
+ `