@tactics/toddle-styleguide 1.2.3 → 1.2.5

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 (77) hide show
  1. package/App.tsx +202 -191
  2. package/index.d.ts +2 -1
  3. package/index.tsx +2 -0
  4. package/package.json +2 -2
  5. package/src/components/atoms/backdrop/backdrop.component.d.ts +2 -1
  6. package/src/components/atoms/backdrop/backdrop.component.tsx +8 -2
  7. package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +1821 -641
  8. package/src/components/atoms/text-input/text-input.component.d.ts +4 -5
  9. package/src/components/atoms/text-input/text-input.component.tsx +9 -13
  10. package/src/components/atoms/text-input/text-input.preview.tsx +5 -5
  11. package/src/components/atoms/text-input/text-input.test.js +4 -4
  12. package/src/components/molecules/avatar/__snapshots__/avatar.test.js.snap +70 -62
  13. package/src/components/molecules/avatar/avatar.component.d.ts +2 -1
  14. package/src/components/molecules/avatar/avatar.component.tsx +22 -11
  15. package/src/components/molecules/avatar/avatar.preview.tsx +58 -44
  16. package/src/components/molecules/avatar/avatar.styles.d.ts +54 -15
  17. package/src/components/molecules/avatar/avatar.styles.js +33 -5
  18. package/src/components/molecules/button/__snapshots__/button.test.js.snap +144 -0
  19. package/src/components/molecules/button/button.component.d.ts +6 -4
  20. package/src/components/molecules/button/button.component.tsx +30 -9
  21. package/src/components/molecules/button/button.preview.tsx +16 -1
  22. package/src/components/molecules/button/button.styles.d.ts +13 -16
  23. package/src/components/molecules/button/button.styles.js +2 -4
  24. package/src/components/molecules/button/button.test.js +12 -0
  25. package/src/components/molecules/date-input/date-input.preview.tsx +25 -23
  26. package/src/components/molecules/message-input/__snapshots__/message-input.test.js.snap +4 -0
  27. package/src/components/molecules/message-input/message-input.component.d.ts +4 -6
  28. package/src/components/molecules/message-input/message-input.component.tsx +10 -12
  29. package/src/components/molecules/message-input/message-input.preview.tsx +28 -15
  30. package/src/components/molecules/password-input/password-input.component.d.ts +4 -6
  31. package/src/components/molecules/password-input/password-input.component.tsx +11 -15
  32. package/src/components/molecules/swipe/__snapshots__/swipe.test.js.snap +263 -420
  33. package/src/components/molecules/swipe/swipe.component.d.ts +4 -4
  34. package/src/components/molecules/swipe/swipe.component.tsx +47 -20
  35. package/src/components/molecules/swipe/swipe.preview.tsx +111 -51
  36. package/src/components/molecules/swipe/swipe.styles.d.ts +28 -0
  37. package/src/components/molecules/swipe/swipe.styles.js +32 -0
  38. package/src/components/molecules/swipe/swipe.test.js +1 -1
  39. package/src/components/molecules/tag/__snapshots__/tag.test.js.snap +10 -10
  40. package/src/components/molecules/tag/tag.component.d.ts +3 -8
  41. package/src/components/molecules/tag/tag.component.tsx +7 -13
  42. package/src/components/molecules/tag/tag.preview.tsx +22 -19
  43. package/src/components/molecules/tag/tag.styles.js +4 -2
  44. package/src/components/molecules/tag/tag.test.js +10 -2
  45. package/src/components/molecules/time-picker/__snapshots__/time-picker.test.js.snap +1868 -1776
  46. package/src/components/molecules/time-picker/time-picker.component.tsx +49 -23
  47. package/src/components/molecules/time-picker/time-picker.preview.tsx +5 -4
  48. package/src/components/molecules/time-picker/time-picker.styles.d.ts +16 -4
  49. package/src/components/molecules/time-picker/time-picker.styles.js +18 -6
  50. package/src/components/molecules/timestamp/__snapshots__/timestamp.test.js.snap +1 -1
  51. package/src/components/molecules/timestamp/timestamp.component.tsx +0 -2
  52. package/src/components/organisms/child-list-item/__snapshots__/child-list-item.test.js.snap +174 -162
  53. package/src/components/organisms/contact-item/__snapshots__/contact-item.test.js.snap +70 -127
  54. package/src/components/organisms/contact-item/contact-item.component.tsx +10 -9
  55. package/src/components/organisms/my-child-list-item/__snapshots__/my-child-list-item.test.js.snap +97 -89
  56. package/src/components/organisms/person-info-card/__snapshots__/person-info-card.test.js.snap +233 -209
  57. package/src/components/organisms/text-bubble/__snapshots__/text-bubble.test.js.snap +7 -7
  58. package/src/components/templates/modal/modal.component.tsx +0 -1
  59. package/src/components/templates/popover/components/modal/modal.component.tsx +0 -1
  60. package/src/components/templates/popover/components/modal/modal.styles.d.ts +2 -1
  61. package/src/components/templates/popover/components/modal/modal.styles.js +2 -2
  62. package/src/components/templates/popover/popover.component.tsx +27 -14
  63. package/src/components/templates/popover/popover.preview.tsx +63 -97
  64. package/src/components/templates/popover/popover.styles.d.ts +1 -1
  65. package/src/components/templates/popover/popover.styles.js +3 -1
  66. package/src/components/templates/popover-action/popover-action.component.d.ts +8 -0
  67. package/src/components/templates/popover-action/popover-action.component.tsx +119 -0
  68. package/src/components/templates/popover-action/popover-action.preview.d.ts +1 -0
  69. package/src/components/templates/popover-action/popover-action.preview.tsx +142 -0
  70. package/src/components/templates/popover-action/popover-action.styles.d.ts +26 -0
  71. package/src/components/templates/popover-action/popover-action.styles.js +31 -0
  72. package/src/utilities/toddle-datetime/toddle-datetime.class.d.ts +5 -0
  73. package/src/utilities/toddle-datetime/toddle-datetime.class.tsx +23 -0
  74. package/src/utilities/toddle-datetime/toddle-datetime.preview.tsx +15 -1
  75. package/src/utilities/toddle-datetime/toddle-datetime.test.js +10 -0
  76. package/src/components/molecules/swipe/Swipe.styles.d.ts +0 -7
  77. package/src/components/molecules/swipe/Swipe.styles.js +0 -10
@@ -428,3 +428,147 @@ exports[`test button component should render a button component with a solid ico
428
428
  </View>
429
429
  </View>
430
430
  `;
431
+
432
+ exports[`test button component should render a success button component 1`] = `
433
+ <View
434
+ accessibilityState={
435
+ {
436
+ "busy": undefined,
437
+ "checked": undefined,
438
+ "disabled": undefined,
439
+ "expanded": undefined,
440
+ "selected": undefined,
441
+ }
442
+ }
443
+ accessibilityValue={
444
+ {
445
+ "max": undefined,
446
+ "min": undefined,
447
+ "now": undefined,
448
+ "text": undefined,
449
+ }
450
+ }
451
+ accessible={true}
452
+ collapsable={false}
453
+ focusable={true}
454
+ onBlur={[Function]}
455
+ onClick={[Function]}
456
+ onFocus={[Function]}
457
+ onResponderGrant={[Function]}
458
+ onResponderMove={[Function]}
459
+ onResponderRelease={[Function]}
460
+ onResponderTerminate={[Function]}
461
+ onResponderTerminationRequest={[Function]}
462
+ onStartShouldSetResponder={[Function]}
463
+ >
464
+ <View
465
+ style={
466
+ {
467
+ "alignItems": "center",
468
+ "backgroundColor": "#67C14E",
469
+ "borderRadius": 50,
470
+ "flexDirection": "row",
471
+ "justifyContent": "center",
472
+ "paddingHorizontal": 24,
473
+ "paddingVertical": 12,
474
+ }
475
+ }
476
+ >
477
+ <View>
478
+ <Text
479
+ style={
480
+ [
481
+ [
482
+ {
483
+ "fontFamily": "SourceSansPro",
484
+ "fontSize": 16,
485
+ "lineHeight": 22.4,
486
+ },
487
+ ],
488
+ {
489
+ "color": "#FFFFFF",
490
+ "textAlign": "center",
491
+ "width": "100%",
492
+ },
493
+ undefined,
494
+ ]
495
+ }
496
+ >
497
+ Success button
498
+ </Text>
499
+ </View>
500
+ </View>
501
+ </View>
502
+ `;
503
+
504
+ exports[`test button component should render an error button component 1`] = `
505
+ <View
506
+ accessibilityState={
507
+ {
508
+ "busy": undefined,
509
+ "checked": undefined,
510
+ "disabled": undefined,
511
+ "expanded": undefined,
512
+ "selected": undefined,
513
+ }
514
+ }
515
+ accessibilityValue={
516
+ {
517
+ "max": undefined,
518
+ "min": undefined,
519
+ "now": undefined,
520
+ "text": undefined,
521
+ }
522
+ }
523
+ accessible={true}
524
+ collapsable={false}
525
+ focusable={true}
526
+ onBlur={[Function]}
527
+ onClick={[Function]}
528
+ onFocus={[Function]}
529
+ onResponderGrant={[Function]}
530
+ onResponderMove={[Function]}
531
+ onResponderRelease={[Function]}
532
+ onResponderTerminate={[Function]}
533
+ onResponderTerminationRequest={[Function]}
534
+ onStartShouldSetResponder={[Function]}
535
+ >
536
+ <View
537
+ style={
538
+ {
539
+ "alignItems": "center",
540
+ "backgroundColor": "#D25E5E",
541
+ "borderRadius": 50,
542
+ "flexDirection": "row",
543
+ "justifyContent": "center",
544
+ "paddingHorizontal": 24,
545
+ "paddingVertical": 12,
546
+ }
547
+ }
548
+ >
549
+ <View>
550
+ <Text
551
+ style={
552
+ [
553
+ [
554
+ {
555
+ "fontFamily": "SourceSansPro",
556
+ "fontSize": 16,
557
+ "lineHeight": 22.4,
558
+ },
559
+ ],
560
+ {
561
+ "color": "#FFFFFF",
562
+ "textAlign": "center",
563
+ "width": "100%",
564
+ },
565
+ undefined,
566
+ ]
567
+ }
568
+ >
569
+ Error button
570
+ </Text>
571
+ </View>
572
+ </View>
573
+ </View>
574
+ `;
@@ -1,12 +1,14 @@
1
+ import { PressableProps } from 'react-native';
1
2
  import { IconNameType, IconStyleType } from '../../../types/icontype.type';
2
- type ButtonProps = {
3
+ type ButtonType = 'regular' | 'error' | 'success';
4
+ interface ButtonProps extends PressableProps {
3
5
  label: string;
4
6
  icon?: boolean;
5
7
  iconStyle?: IconStyleType;
6
8
  iconName?: IconNameType;
7
9
  iconSize?: number;
8
10
  disabled?: boolean;
9
- onPress?: () => void;
10
- };
11
- declare const Button: ({ label, icon, iconStyle, iconName, iconSize, disabled, onPress, }: ButtonProps) => JSX.Element;
11
+ type?: ButtonType;
12
+ }
13
+ declare const Button: ({ label, icon, iconStyle, iconName, iconSize, disabled, type, ...props }: ButtonProps) => JSX.Element;
12
14
  export { Button as Button };
@@ -1,22 +1,24 @@
1
1
  import * as React from 'react';
2
2
  import {useContext} from 'react';
3
3
 
4
- import {Pressable, View} from 'react-native';
4
+ import {Pressable, PressableProps, View} from 'react-native';
5
5
  import {ThemeCtx} from '../../../context/theme.context';
6
6
  import {Stylesheet} from './button.styles';
7
7
  import {Heading4} from '../../atoms/heading-components';
8
8
  import {IconNameType, IconStyleType} from '../../../types/icontype.type';
9
9
  import {Icon} from '../../../icons/index';
10
10
 
11
- type ButtonProps = {
11
+ type ButtonType = 'regular' | 'error' | 'success';
12
+
13
+ interface ButtonProps extends PressableProps {
12
14
  label: string;
13
15
  icon?: boolean;
14
16
  iconStyle?: IconStyleType;
15
17
  iconName?: IconNameType;
16
18
  iconSize?: number;
17
19
  disabled?: boolean;
18
- onPress?: () => void;
19
- };
20
+ type?: ButtonType;
21
+ }
20
22
 
21
23
  const Button = ({
22
24
  label,
@@ -25,13 +27,24 @@ const Button = ({
25
27
  iconName = 'calendar',
26
28
  iconSize,
27
29
  disabled,
28
- onPress,
30
+ type = 'regular',
31
+ ...props
29
32
  }: ButtonProps) => {
30
33
  const context = useContext(ThemeCtx);
31
- const styles = Stylesheet(context, disabled);
34
+
35
+ let buttonColor;
36
+ if (type === 'error') {
37
+ buttonColor = context.colors.ui.error.dark;
38
+ } else if (type === 'success') {
39
+ buttonColor = context.colors.ui.success.dark;
40
+ } else {
41
+ buttonColor = context.colors.main['0'];
42
+ }
43
+
44
+ const styles = Stylesheet(context, disabled, buttonColor);
32
45
 
33
46
  return (
34
- <Pressable disabled={disabled} onPress={onPress}>
47
+ <Pressable disabled={disabled} {...props}>
35
48
  <View style={styles.container}>
36
49
  {icon ? (
37
50
  <View style={styles.iconGap}>
@@ -39,7 +52,11 @@ const Button = ({
39
52
  style={iconStyle}
40
53
  name={iconName}
41
54
  color={
42
- disabled ? context.colors.ui.darkgrey : context.colors.main['9']
55
+ disabled
56
+ ? context.colors.ui.darkgrey
57
+ : type === 'regular'
58
+ ? context.colors.main['9']
59
+ : context.colors.ui.white
43
60
  }
44
61
  size={iconSize}
45
62
  />
@@ -49,7 +66,11 @@ const Button = ({
49
66
  <Heading4
50
67
  textAlign={'center'}
51
68
  textColor={
52
- disabled ? context.colors.ui.darkgrey : context.colors.main['9']
69
+ disabled
70
+ ? context.colors.ui.darkgrey
71
+ : type === 'regular'
72
+ ? context.colors.main['9']
73
+ : context.colors.ui.white
53
74
  }
54
75
  >
55
76
  {label}
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import {Button} from './button.component';
3
- import {Icon} from '../../../icons/index';
4
3
  const {View} = require('react-native');
5
4
 
6
5
  export const ButtonPreview = ({}: {}) => {
@@ -13,6 +12,16 @@ export const ButtonPreview = ({}: {}) => {
13
12
  }}
14
13
  >
15
14
  <Button label="Default button" onPress={() => console.log('clicked')} />
15
+ <Button
16
+ label="Error button"
17
+ type={'error'}
18
+ onPress={() => console.log('clicked')}
19
+ />
20
+ <Button
21
+ label="Success button"
22
+ type={'success'}
23
+ onPress={() => console.log('clicked')}
24
+ />
16
25
  <Button
17
26
  label="Icon button"
18
27
  icon={true}
@@ -24,6 +33,12 @@ export const ButtonPreview = ({}: {}) => {
24
33
  disabled={true}
25
34
  onPress={() => console.log('clicked')}
26
35
  />
36
+ <Button
37
+ label="Success disabled"
38
+ type={'success'}
39
+ disabled={true}
40
+ onPress={() => console.log('clicked')}
41
+ />
27
42
  <Button
28
43
  label="Disabled Icon button"
29
44
  disabled={true}
@@ -1,17 +1,14 @@
1
- export function Stylesheet(
2
- context: any,
3
- disabled: any
4
- ): {
5
- container: {
6
- backgroundColor: any;
7
- paddingVertical: number;
8
- paddingHorizontal: number;
9
- flexDirection: 'row';
10
- justifyContent: 'center';
11
- alignItems: 'center';
12
- borderRadius: number;
13
- };
14
- iconGap: {
15
- marginRight: number;
16
- };
1
+ export function Stylesheet(context: any, disabled: any, buttonColor: any): {
2
+ container: {
3
+ backgroundColor: any;
4
+ paddingVertical: number;
5
+ paddingHorizontal: number;
6
+ flexDirection: "row";
7
+ justifyContent: "center";
8
+ alignItems: "center";
9
+ borderRadius: number;
10
+ };
11
+ iconGap: {
12
+ marginRight: number;
13
+ };
17
14
  };
@@ -1,12 +1,10 @@
1
1
  import {StyleSheet} from 'react-native';
2
2
  import {Scale} from '../../../theme/scale';
3
3
 
4
- export const Stylesheet = (context, disabled) =>
4
+ export const Stylesheet = (context, disabled, buttonColor) =>
5
5
  StyleSheet.create({
6
6
  container: {
7
- backgroundColor: disabled
8
- ? context.colors.ui.lightgrey
9
- : context.colors.main['0'],
7
+ backgroundColor: disabled ? context.colors.ui.lightgrey : buttonColor,
10
8
  paddingVertical: Scale.s,
11
9
  paddingHorizontal: Scale.l,
12
10
  flexDirection: 'row',
@@ -7,6 +7,18 @@ describe('test button component', () => {
7
7
  const tree = render.create(<Button label="Test button" />).toJSON();
8
8
  expect(tree).toMatchSnapshot();
9
9
  });
10
+ it('should render a success button component', function () {
11
+ const tree = render
12
+ .create(<Button type={'success'} label="Success button" />)
13
+ .toJSON();
14
+ expect(tree).toMatchSnapshot();
15
+ });
16
+ it('should render an error button component', function () {
17
+ const tree = render
18
+ .create(<Button type={'error'} label="Error button" />)
19
+ .toJSON();
20
+ expect(tree).toMatchSnapshot();
21
+ });
10
22
  it('should render a button component that is disabled', () => {
11
23
  const tree = render
12
24
  .create(<Button label="Button without icon" disabled={true} />)
@@ -7,6 +7,7 @@ import {TextInput} from '../../atoms/text-input/text-input.component';
7
7
  import {KeyBoardTypes} from '../../../types/keyboard-types.enum';
8
8
  import {Popover} from '../../templates/popover/popover.component';
9
9
  import {Calendar} from '../../atoms/calendar/calendar.component';
10
+ import {Modal} from '../../templates/modal/modal.component';
10
11
 
11
12
  const {View} = require('react-native');
12
13
 
@@ -15,30 +16,31 @@ export const DateInputPreview = ({}: {}) => {
15
16
  const [popoverIsVisible, setPopoverIsVisible] = useState(false);
16
17
 
17
18
  return (
18
- <View
19
- style={{
20
- padding: 50,
21
- }}
22
- >
23
- <Info
24
- label={'Afwezigheid melden'}
25
- description={
26
- 'Kan u kind een dag niet aanwezig zijn? Laat het via deze weg weten aan de opvanglocatie.'
27
- }
28
- />
29
-
30
- <Text>Kind</Text>
31
- <TextInput
32
- keyboardType={KeyBoardTypes.DEFAULT}
33
- placeholder={'De uiltjes'}
34
- />
19
+ <>
20
+ <View
21
+ style={{
22
+ padding: 50,
23
+ }}
24
+ >
25
+ <Info
26
+ label={'Afwezigheid melden'}
27
+ description={
28
+ 'Kan u kind een dag niet aanwezig zijn? Laat het via deze weg weten aan de opvanglocatie.'
29
+ }
30
+ />
35
31
 
36
- <Text>Afwezig op</Text>
37
- <DateInput
38
- value={selectedDate}
39
- onPress={() => setPopoverIsVisible(true)}
40
- />
32
+ <Text>Kind</Text>
33
+ <TextInput
34
+ keyboardType={KeyBoardTypes.DEFAULT}
35
+ placeholder={'De uiltjes'}
36
+ />
41
37
 
38
+ <Text>Afwezig op</Text>
39
+ <DateInput
40
+ value={selectedDate}
41
+ onPress={() => setPopoverIsVisible(true)}
42
+ />
43
+ </View>
42
44
  <Popover
43
45
  onClose={() => setPopoverIsVisible(false)}
44
46
  title={'Datum'}
@@ -55,6 +57,6 @@ export const DateInputPreview = ({}: {}) => {
55
57
  />
56
58
  </View>
57
59
  </Popover>
58
- </View>
60
+ </>
59
61
  );
60
62
  };
@@ -109,6 +109,7 @@ exports[`Message Input test render a message text input component with placehold
109
109
  </RNSVGSvgView>
110
110
  </View>
111
111
  <TextInput
112
+ addAttachment={[Function]}
112
113
  keyboardType="default"
113
114
  multiline={true}
114
115
  onChangeText={[Function]}
@@ -346,6 +347,7 @@ exports[`Message Input test render a message text input component with placehold
346
347
  </RNSVGSvgView>
347
348
  </View>
348
349
  <TextInput
350
+ addAttachment={[Function]}
349
351
  keyboardType="email-address"
350
352
  multiline={true}
351
353
  onChangeText={[Function]}
@@ -583,6 +585,7 @@ exports[`Message Input test render a message text input component without placeh
583
585
  </RNSVGSvgView>
584
586
  </View>
585
587
  <TextInput
588
+ addAttachment={[Function]}
586
589
  keyboardType="default"
587
590
  multiline={true}
588
591
  onChangeText={[Function]}
@@ -819,6 +822,7 @@ exports[`Message Input test render a message text input component without placeh
819
822
  </RNSVGSvgView>
820
823
  </View>
821
824
  <TextInput
825
+ addAttachment={[Function]}
822
826
  keyboardType="email-address"
823
827
  multiline={true}
824
828
  onChangeText={[Function]}
@@ -1,11 +1,9 @@
1
+ import { TextInputProps } from 'react-native';
1
2
  import { KeyBoardTypes } from '../../../types/keyboard-types.enum';
2
- type MessageInputProps = {
3
- placeholder?: string;
4
- onChangeText: (text: string) => void;
5
- value: string;
3
+ interface MessageInputProps extends TextInputProps {
6
4
  keyboardType?: KeyBoardTypes;
7
5
  onPressSend: () => void;
8
6
  addAttachment: () => void;
9
- };
10
- declare const MessageInput: ({ placeholder, onChangeText, value, keyboardType, onPressSend, }: MessageInputProps) => JSX.Element;
7
+ }
8
+ declare const MessageInput: ({ keyboardType, onPressSend, ...props }: MessageInputProps) => JSX.Element;
11
9
  export { MessageInput };
@@ -1,25 +1,25 @@
1
1
  import React, {useContext} from 'react';
2
- import {Pressable, TextInput as RNTextInput, View} from 'react-native';
2
+ import {
3
+ Pressable,
4
+ TextInput as RNTextInput,
5
+ TextInputProps,
6
+ View,
7
+ } from 'react-native';
3
8
  import {Icon} from '../../../icons/index';
4
9
  import {Stylesheet} from './message-input.styles';
5
10
  import {ThemeCtx} from '../../../context/theme.context';
6
11
  import {KeyBoardTypes} from '../../../types/keyboard-types.enum';
7
12
 
8
- type MessageInputProps = {
9
- placeholder?: string;
10
- onChangeText: (text: string) => void;
11
- value: string;
13
+ interface MessageInputProps extends TextInputProps {
12
14
  keyboardType?: KeyBoardTypes;
13
15
  onPressSend: () => void;
14
16
  addAttachment: () => void;
15
- };
17
+ }
16
18
 
17
19
  const MessageInput = ({
18
- placeholder,
19
- onChangeText,
20
- value,
21
20
  keyboardType,
22
21
  onPressSend,
22
+ ...props
23
23
  }: MessageInputProps) => {
24
24
  const Context = useContext(ThemeCtx);
25
25
  const styles = Stylesheet(Context);
@@ -36,11 +36,9 @@ const MessageInput = ({
36
36
  <RNTextInput
37
37
  style={styles.textInput}
38
38
  multiline={true}
39
- placeholder={placeholder}
40
39
  placeholderTextColor={Context.colors.ui.grey}
41
- onChangeText={onChangeText}
42
- value={value}
43
40
  keyboardType={keyboardType ? keyboardType : KeyBoardTypes.DEFAULT}
41
+ {...props}
44
42
  />
45
43
  <Pressable onPress={onPressSend}>
46
44
  <Icon
@@ -1,6 +1,7 @@
1
1
  import React, {useState} from 'react';
2
- import {View} from 'react-native';
2
+ import {KeyboardAvoidingView, Platform, View} from 'react-native';
3
3
  import {MessageInput} from './message-input.component';
4
+ import {KeyBoardTypes} from '../../../types/keyboard-types.enum';
4
5
 
5
6
  export const MessageInputPreview = ({}: {}) => {
6
7
  const [input, setInput] = useState('');
@@ -18,24 +19,36 @@ export const MessageInputPreview = ({}: {}) => {
18
19
  };
19
20
 
20
21
  return (
21
- <View
22
+ <KeyboardAvoidingView
23
+ behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
22
24
  style={{
23
25
  flex: 1,
24
- alignItems: 'center',
25
- justifyContent: 'center',
26
- padding: 16,
26
+ backgroundColor: '#ECECEC',
27
+ borderRadius: 10,
28
+ paddingVertical: 5,
29
+ marginLeft: 10,
27
30
  }}
28
31
  >
29
- <MessageInput
30
- placeholder={'Type a message'}
31
- value={input}
32
- onChangeText={onChangeHandler}
33
- onPressSend={() => {
34
- submitHandler(input);
35
- clear();
32
+ <View
33
+ style={{
34
+ flex: 1,
35
+ alignItems: 'center',
36
+ justifyContent: 'center',
37
+ padding: 16,
36
38
  }}
37
- addAttachment={() => alert('add an image')}
38
- />
39
- </View>
39
+ >
40
+ <MessageInput
41
+ placeholder={'Type a message'}
42
+ value={input}
43
+ onChangeText={onChangeHandler}
44
+ onPressSend={() => {
45
+ submitHandler(input);
46
+ clear();
47
+ }}
48
+ addAttachment={() => alert('add an image')}
49
+ keyboardType={KeyBoardTypes.DEFAULT}
50
+ />
51
+ </View>
52
+ </KeyboardAvoidingView>
40
53
  );
41
54
  };
@@ -1,9 +1,7 @@
1
+ import { TextInputProps } from 'react-native';
1
2
  import { KeyBoardTypes } from '../../../types/keyboard-types.enum';
2
- type PasswordInputProps = {
3
- placeholder?: string;
4
- onChangeText: (text: string) => void;
5
- value: string;
3
+ interface PasswordInputProps extends Omit<TextInputProps, 'secureTextEntry' | 'keyboardType'> {
6
4
  keyboardType?: KeyBoardTypes;
7
- };
8
- export declare const PasswordInput: ({ placeholder, onChangeText, value, keyboardType, }: PasswordInputProps) => JSX.Element;
5
+ }
6
+ export declare const PasswordInput: ({ keyboardType, ...props }: PasswordInputProps) => JSX.Element;
9
7
  export {};
@@ -1,24 +1,22 @@
1
1
  import * as React from 'react';
2
2
  import {useContext, useState} from 'react';
3
- import {Pressable, TextInput as RNTextInput, View} from 'react-native';
3
+ import {
4
+ Pressable,
5
+ TextInput as RNTextInput,
6
+ TextInputProps,
7
+ View,
8
+ } from 'react-native';
4
9
  import {ThemeCtx} from '../../../context/theme.context';
5
10
  import {Stylesheet} from './password-input.styles';
6
11
  import {Icon} from '../../../icons';
7
12
  import {KeyBoardTypes} from '../../../types/keyboard-types.enum';
8
13
 
9
- type PasswordInputProps = {
10
- placeholder?: string;
11
- onChangeText: (text: string) => void;
12
- value: string;
14
+ interface PasswordInputProps
15
+ extends Omit<TextInputProps, 'secureTextEntry' | 'keyboardType'> {
13
16
  keyboardType?: KeyBoardTypes;
14
- };
17
+ }
15
18
 
16
- export const PasswordInput = ({
17
- placeholder,
18
- onChangeText,
19
- value,
20
- keyboardType,
21
- }: PasswordInputProps) => {
19
+ export const PasswordInput = ({keyboardType, ...props}: PasswordInputProps) => {
22
20
  const [secure, setSecure] = useState(true);
23
21
 
24
22
  const Context = useContext(ThemeCtx);
@@ -29,12 +27,10 @@ export const PasswordInput = ({
29
27
  <View style={styles.textInputContainer}>
30
28
  <RNTextInput
31
29
  style={styles.textInput}
32
- placeholder={placeholder}
33
30
  placeholderTextColor={Context.colors.ui.grey}
34
31
  secureTextEntry={secure}
35
- value={value}
36
- onChangeText={onChangeText}
37
32
  keyboardType={keyboardType ? keyboardType : KeyBoardTypes.DEFAULT}
33
+ {...props}
38
34
  />
39
35
  </View>
40
36
  <Pressable