unicorn-demo-app 7.16.0 → 7.17.0

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": "unicorn-demo-app",
3
- "version": "7.16.0",
3
+ "version": "7.17.0",
4
4
  "main": "src/index.js",
5
5
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
6
6
  "license": "MIT",
@@ -51,7 +51,7 @@ export const navigationData = {
51
51
  title: 'Form',
52
52
  screens: [
53
53
  {title: 'Checkbox', tags: 'checkbox toggle controls', screen: 'unicorn.components.CheckboxScreen'},
54
- {title: 'Color Picker', tags: 'color picker control', screen: 'unicorn.components.ColorPickerScreen'},
54
+ {title: 'ColorPicker', tags: 'color picker control', screen: 'unicorn.components.ColorPickerScreen'},
55
55
  {title: 'Color Swatch', tags: 'color swatch and palette', screen: 'unicorn.components.ColorSwatchScreen'},
56
56
  {title: 'TextField', tags: 'text input field form', screen: 'unicorn.components.TextFieldScreen'},
57
57
  {title: 'NumberInput', tags: 'number input', screen: 'unicorn.components.NumberInputScreen'},
@@ -62,12 +62,14 @@ export default class DateTimePickerScreen extends Component<{}, State> {
62
62
  <View padding-page>
63
63
  <Text text40>Date Time Picker</Text>
64
64
  <DateTimePicker
65
+ migrateDialog
65
66
  containerStyle={{marginVertical: 20}}
66
67
  label={'Date'}
67
68
  placeholder={'Select a date'}
68
69
  // value={new Date('October 13, 2014')}
69
70
  />
70
71
  <DateTimePicker
72
+ migrateDialog
71
73
  mode={'time'}
72
74
  label={'Time'}
73
75
  placeholder={'Select time'}
@@ -78,12 +80,14 @@ export default class DateTimePickerScreen extends Component<{}, State> {
78
80
  Disabled
79
81
  </Text>
80
82
  <DateTimePicker
83
+ migrateDialog
81
84
  containerStyle={{marginBottom: 20}}
82
85
  editable={false}
83
86
  label={'Date'}
84
87
  placeholder={'Select a date'}
85
88
  />
86
89
  <DateTimePicker
90
+ migrateDialog
87
91
  editable={false}
88
92
  mode={'time'}
89
93
  label={'Time'}
@@ -104,6 +108,7 @@ export default class DateTimePickerScreen extends Component<{}, State> {
104
108
  </View>
105
109
  </View>
106
110
  <DateTimePicker
111
+ migrateDialog
107
112
  containerStyle={{marginVertical: 20}}
108
113
  renderInput={this.renderCustomInput}
109
114
  mode={mode}
@@ -1,41 +1,73 @@
1
1
  import React, {useState} from 'react';
2
- import {Assets, View, Icon, Text, Slider, Switch, GradientSlider} from 'react-native-ui-lib';
2
+ import {Assets, View, Icon, Text, Slider, GradientSlider, Colors} from 'react-native-ui-lib';
3
+ import {renderBooleanOption} from '../ExampleScreenPresenter';
4
+
5
+ const DEFAULT_BADGE_SIZE = 20;
6
+ const DEFAULT_PIMPLE_SIZE = 10;
3
7
 
4
8
  const IconScreen = () => {
5
9
  const [size, setSize] = useState(24);
10
+ const [badgeSize, setBadgeSize] = useState(20);
6
11
  const [customSize, setCustomSize] = useState(false);
12
+ const [customBadgeSize, setCustomBadgeSize] = useState(false);
7
13
  const [color, setColor] = useState<string | number>();
8
14
  const [customColor, setCustomColor] = useState(false);
15
+ const [useBadge, setUseBadge] = useState(false);
16
+ const [usePimple, setUsePimple] = useState(false);
9
17
 
10
18
  return (
11
19
  <View padding-page>
12
20
  <Text h1 marginB-s4>
13
21
  Icon Screen
14
22
  </Text>
15
- <View center>
23
+ <View center margin-page>
16
24
  <Icon
17
- margin-30
18
25
  size={customSize ? size : undefined}
19
- tintColor={customColor ? color as string : undefined}
26
+ tintColor={customColor ? (color as string) : undefined}
20
27
  source={Assets.icons.search}
28
+ badgeProps={
29
+ useBadge
30
+ ? {
31
+ size: customBadgeSize ? badgeSize : usePimple ? DEFAULT_PIMPLE_SIZE : DEFAULT_BADGE_SIZE,
32
+ backgroundColor: Colors.red30,
33
+ label: !usePimple ? '5' : undefined
34
+ }
35
+ : undefined
36
+ }
21
37
  />
22
38
  </View>
23
39
 
24
- <View marginB-s3 row>
25
- <Text marginR-s2>Custom Size</Text>
26
- <Switch value={customSize} onValueChange={setCustomSize}/>
27
- </View>
40
+ {renderBooleanOption('Custom Size', 'customSize', {spread: false, state: customSize, setState: setCustomSize})}
28
41
  <Slider maximumValue={100} value={24} step={1} onValueChange={setSize}/>
29
42
  <Text marginB-50 marginT-s2>
30
43
  Custom size: {size}
31
44
  </Text>
32
45
 
33
- <View marginB-s3 row>
34
- <Text marginR-s2>Custom Color</Text>
35
- <Switch value={customColor} onValueChange={setCustomColor}/>
36
- </View>
46
+ {renderBooleanOption('Custom Badge Size', 'customBadgeSize', {
47
+ spread: false,
48
+ state: customBadgeSize,
49
+ setState: setCustomBadgeSize
50
+ })}
51
+ <Slider maximumValue={100} value={20} step={1} onValueChange={setBadgeSize}/>
52
+ <Text marginB-50 marginT-s2>
53
+ Custom badge size: {badgeSize}
54
+ </Text>
55
+
56
+ {renderBooleanOption('Custom Color', 'customColor', {
57
+ spread: false,
58
+ state: customColor,
59
+ setState: setCustomColor
60
+ })}
37
61
  <GradientSlider type={GradientSlider.types.HUE} color={color as string} onValueChange={setColor}/>
38
62
  <Text marginT-s2>Custom color: {color || '#000000'}</Text>
63
+
64
+ <View marginV-s5>
65
+ <Text marginR-s2 marginB-s2 text80BO>
66
+ Badge Settings:
67
+ </Text>
68
+ {renderBooleanOption('Use Badge:', 'useBadge', {spread: false, state: useBadge, setState: setUseBadge})}
69
+ {renderBooleanOption('Pimple Badge', 'showLabel', {spread: false, state: usePimple, setState: setUsePimple})}
70
+ </View>
39
71
  </View>
40
72
  );
41
73
  };
@@ -13,6 +13,7 @@ import {
13
13
  PanningProvider,
14
14
  Typography,
15
15
  PickerProps,
16
+ RenderCustomModalProps,
16
17
  PickerMethods,
17
18
  Button
18
19
  } from 'react-native-ui-lib'; //eslint-disable-line
@@ -73,7 +74,7 @@ export default class PickerScreen extends Component {
73
74
  contact: 0
74
75
  };
75
76
 
76
- renderDialog: PickerProps['renderCustomModal'] = modalProps => {
77
+ renderDialog: PickerProps['renderCustomModal'] = (modalProps: RenderCustomModalProps) => {
77
78
  const {visible, children, toggleModal, onDone} = modalProps;
78
79
 
79
80
  return (
@@ -81,7 +82,7 @@ export default class PickerScreen extends Component {
81
82
  visible={visible}
82
83
  onDismiss={() => {
83
84
  onDone();
84
- toggleModal(false);
85
+ toggleModal();
85
86
  }}
86
87
  width="100%"
87
88
  height="45%"
@@ -1,6 +1,6 @@
1
1
  import React, {useCallback} from 'react';
2
2
  import {StyleSheet} from 'react-native';
3
- import {Text, View, Colors, SegmentedControl, Assets, Spacings, BorderRadiuses} from 'react-native-ui-lib';
3
+ import {Text, View, Colors, SegmentedControl, Assets, Spacings, BorderRadiuses, Typography} from 'react-native-ui-lib';
4
4
 
5
5
  const segments = {
6
6
  first: [{label: 'Left'}, {label: 'Right'}],
@@ -16,18 +16,21 @@ const segments = {
16
16
  ],
17
17
  forth: [{label: 'With'}, {label: 'Custom'}, {label: 'Style'}],
18
18
  fifth: [{label: 'Full'}, {label: 'Width'}],
19
- sixth: [{label: 'Full'}, {label: 'Width'}, {label: 'With'}, {label: 'A'}, {label: 'Very Long Segment'}]
19
+ sixth: [{label: 'Full'}, {label: 'Width'}, {label: 'With'}, {label: 'A'}, {label: 'Very Long Segment'}],
20
+ seventh: [{label: '$'}, {label: '%'}]
20
21
  };
21
22
 
22
23
  const SegmentedControlScreen = () => {
23
-
24
24
  const onChangeIndex = useCallback((index: number) => {
25
25
  console.warn('Index ' + index + ' of the second segmentedControl was pressed');
26
26
  }, []);
27
27
 
28
28
  return (
29
29
  <View flex bottom padding-page>
30
- <View flex centerV>
30
+ <Text center text40 $textDefault>
31
+ Segmented Control
32
+ </Text>
33
+ <View flex marginT-s8>
31
34
  <View center>
32
35
  <SegmentedControl segments={segments.first}/>
33
36
  <SegmentedControl
@@ -53,18 +56,17 @@ const SegmentedControlScreen = () => {
53
56
  segmentsStyle={styles.customSegmentsStyle}
54
57
  />
55
58
  </View>
59
+ <SegmentedControl containerStyle={styles.container} segments={segments.fifth}/>
60
+ <SegmentedControl containerStyle={styles.container} segments={segments.sixth}/>
61
+ <Text marginT-s4 center>
62
+ Custom Typography
63
+ </Text>
56
64
  <SegmentedControl
57
65
  containerStyle={styles.container}
58
- segments={segments.fifth}
59
- />
60
- <SegmentedControl
61
- containerStyle={styles.container}
62
- segments={segments.sixth}
66
+ segments={segments.seventh}
67
+ segmentLabelStyle={styles.customTypography}
63
68
  />
64
69
  </View>
65
- <Text text40 $textDefault>
66
- Segmented Control
67
- </Text>
68
70
  </View>
69
71
  );
70
72
  };
@@ -79,6 +81,9 @@ const styles = StyleSheet.create({
79
81
  },
80
82
  customSegmentsStyle: {
81
83
  height: 50
84
+ },
85
+ customTypography: {
86
+ ...Typography.text80BO
82
87
  }
83
88
  });
84
89
 
@@ -112,7 +112,6 @@ export default class SliderScreen extends Component<SliderScreenProps, SliderScr
112
112
  step={1}
113
113
  containerStyle={styles.sliderContainer}
114
114
  disableRTL={forceLTR}
115
- // @ts-expect-error
116
115
  ref={this.slider}
117
116
  onReset={this.onSliderReset}
118
117
  />
@@ -208,7 +207,6 @@ export default class SliderScreen extends Component<SliderScreenProps, SliderScr
208
207
  maximumValue={100}
209
208
  step={1}
210
209
  disableRTL={forceLTR}
211
- // @ts-expect-error
212
210
  ref={this.rangeSlider}
213
211
  onReset={this.onRangeSliderReset}
214
212
  />
@@ -7,6 +7,7 @@ const contents = [
7
7
  'SUCCESS state with label.',
8
8
  'ERROR state with icon.',
9
9
  'Custom color with icon and outline.\nAligned to title',
10
+ 'Icon without background.',
10
11
  'NEXT state with outline.',
11
12
  'NEXT state with circle point and entry point.'
12
13
  ];
@@ -27,8 +28,10 @@ const TimelineScreen = () => {
27
28
  const renderExtraContent = () => {
28
29
  return (
29
30
  <View style={{flex: 1, marginTop: 10, backgroundColor: Colors.grey70}}>
30
- <Text>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
31
- Lorem Ipsum is simply dummy text of the printing and typesetting industry</Text>
31
+ <Text>
32
+ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of
33
+ the printing and typesetting industry
34
+ </Text>
32
35
  </View>
33
36
  );
34
37
  };
@@ -62,7 +65,7 @@ const TimelineScreen = () => {
62
65
  <Timeline
63
66
  // key={String(expand)}
64
67
  // topLine={{
65
- // type: Timeline.lineTypes.DASHED,
68
+ // type: Timeline.lineTypes.DASHED,
66
69
  // entry: true
67
70
  // }}
68
71
  bottomLine={{type: Timeline.lineTypes.DASHED}}
@@ -107,10 +110,23 @@ const TimelineScreen = () => {
107
110
  >
108
111
  {renderContent(3)}
109
112
  </Timeline>
113
+ <Timeline
114
+ topLine={{type: Timeline.lineTypes.DASHED, color: Colors.purple30}}
115
+ bottomLine={{
116
+ type: Timeline.lineTypes.DASHED,
117
+ color: Colors.blue30
118
+ }}
119
+ point={{
120
+ icon: Assets.icons.demo.camera,
121
+ removeIconBackground: true
122
+ }}
123
+ >
124
+ {renderContent(4)}
125
+ </Timeline>
110
126
  <Timeline
111
127
  topLine={{
112
128
  type: Timeline.lineTypes.DASHED,
113
- color: Colors.purple30
129
+ color: Colors.blue30
114
130
  }}
115
131
  bottomLine={{
116
132
  state: Timeline.states.NEXT,
@@ -121,7 +137,7 @@ const TimelineScreen = () => {
121
137
  type: Timeline.pointTypes.OUTLINE
122
138
  }}
123
139
  >
124
- {renderContent(4)}
140
+ {renderContent(5)}
125
141
  </Timeline>
126
142
 
127
143
  <Timeline
@@ -138,7 +154,7 @@ const TimelineScreen = () => {
138
154
  type: Timeline.pointTypes.CIRCLE
139
155
  }}
140
156
  >
141
- {renderContent(5)}
157
+ {renderContent(6)}
142
158
  </Timeline>
143
159
  </ScrollView>
144
160
  </>
@@ -112,6 +112,7 @@ export default class TextFieldScreen extends Component {
112
112
  useDialog
113
113
  expandableContent={this.renderPickerContent()}
114
114
  dialogProps={{bottom: true, onDismiss: () => console.warn('Dialog is dismissed')}}
115
+ migrateDialog
115
116
  >
116
117
  {this.renderColorRow(selectedColor)}
117
118
  </Incubator.ExpandableOverlay>
@@ -21,6 +21,7 @@ const IncubatorSliderScreen = () => {
21
21
  const [sliderMaxValue, setSliderMaxValue] = useState(INITIAL_MAX);
22
22
 
23
23
  const [color, setColor] = useState(COLOR);
24
+ const [groupColor, setGroupColor] = useState(Colors.yellow30);
24
25
  const [alpha, setAlpha] = useState(1);
25
26
 
26
27
  const slider = useRef<Incubator.SliderRef>(null);
@@ -58,7 +59,7 @@ const IncubatorSliderScreen = () => {
58
59
  }, []);
59
60
 
60
61
  const onGroupValueChange = (value: string) => {
61
- console.log('onGroupValueChange: ', value);
62
+ setGroupColor(value);
62
63
  };
63
64
 
64
65
  const renderValuesBox = (min: number, max?: number) => {
@@ -235,9 +236,9 @@ const IncubatorSliderScreen = () => {
235
236
  Color Slider Group
236
237
  </Text>
237
238
  <ColorSliderGroup
238
- initialColor={color}
239
+ initialColor={groupColor}
239
240
  sliderContainerStyle={styles.slider}
240
- containerStyle={styles.group}
241
+ containerStyle={[styles.group, {borderWidth: 12, borderColor: groupColor}]}
241
242
  showLabels
242
243
  onValueChange={onGroupValueChange}
243
244
  migrate