unicorn-demo-app 7.5.2 → 7.6.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.5.2",
3
+ "version": "7.6.0",
4
4
  "main": "src/index.js",
5
5
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
6
6
  "license": "MIT",
@@ -53,7 +53,6 @@ export function renderBooleanOption(title: string,
53
53
  {title}
54
54
  </Text>
55
55
  <Switch
56
- useCustomTheme
57
56
  key={key}
58
57
  testID={key}
59
58
  value={value}
@@ -84,7 +83,6 @@ export function renderBooleanGroup(title: string, options: string[]) {
84
83
  <View spread centerH row key={key}>
85
84
  <Checkbox
86
85
  marginR-s2
87
- useCustomTheme
88
86
  key={key}
89
87
  testID={key}
90
88
  value={value}
@@ -125,7 +123,6 @@ export function renderRadioGroup(title: string,
125
123
  {_.map(options, (value, key) => {
126
124
  return (
127
125
  <RadioButton
128
- useCustomTheme
129
126
  testID={key}
130
127
  key={key}
131
128
  marginB-s2
@@ -36,7 +36,7 @@ exports[`AvatarScreen renders screen 1`] = `
36
36
  {
37
37
  "backgroundColor": "transparent",
38
38
  "color": "#20303C",
39
- "textAlign": "left",
39
+ "writingDirection": "ltr",
40
40
  },
41
41
  undefined,
42
42
  {
@@ -159,7 +159,7 @@ exports[`AvatarScreen renders screen 1`] = `
159
159
  {
160
160
  "backgroundColor": "transparent",
161
161
  "color": "#20303C",
162
- "textAlign": "left",
162
+ "writingDirection": "ltr",
163
163
  },
164
164
  undefined,
165
165
  {
@@ -289,7 +289,7 @@ exports[`AvatarScreen renders screen 1`] = `
289
289
  {
290
290
  "backgroundColor": "transparent",
291
291
  "color": "#20303C",
292
- "textAlign": "left",
292
+ "writingDirection": "ltr",
293
293
  },
294
294
  {
295
295
  "fontFamily": "System",
@@ -342,7 +342,7 @@ exports[`AvatarScreen renders screen 1`] = `
342
342
  {
343
343
  "backgroundColor": "transparent",
344
344
  "color": "#20303C",
345
- "textAlign": "left",
345
+ "writingDirection": "ltr",
346
346
  },
347
347
  undefined,
348
348
  {
@@ -444,7 +444,7 @@ exports[`AvatarScreen renders screen 1`] = `
444
444
  {
445
445
  "backgroundColor": "transparent",
446
446
  "color": "#20303C",
447
- "textAlign": "left",
447
+ "writingDirection": "ltr",
448
448
  },
449
449
  undefined,
450
450
  undefined,
@@ -514,7 +514,7 @@ exports[`AvatarScreen renders screen 1`] = `
514
514
  {
515
515
  "backgroundColor": "transparent",
516
516
  "color": "#20303C",
517
- "textAlign": "left",
517
+ "writingDirection": "ltr",
518
518
  },
519
519
  {
520
520
  "fontFamily": "System",
@@ -567,7 +567,7 @@ exports[`AvatarScreen renders screen 1`] = `
567
567
  {
568
568
  "backgroundColor": "transparent",
569
569
  "color": "#20303C",
570
- "textAlign": "left",
570
+ "writingDirection": "ltr",
571
571
  },
572
572
  undefined,
573
573
  {
@@ -669,7 +669,7 @@ exports[`AvatarScreen renders screen 1`] = `
669
669
  {
670
670
  "backgroundColor": "transparent",
671
671
  "color": "#20303C",
672
- "textAlign": "left",
672
+ "writingDirection": "ltr",
673
673
  },
674
674
  undefined,
675
675
  undefined,
@@ -797,7 +797,7 @@ exports[`AvatarScreen renders screen 1`] = `
797
797
  {
798
798
  "backgroundColor": "transparent",
799
799
  "color": "#20303C",
800
- "textAlign": "left",
800
+ "writingDirection": "ltr",
801
801
  },
802
802
  undefined,
803
803
  {
@@ -1048,7 +1048,7 @@ exports[`AvatarScreen renders screen 1`] = `
1048
1048
  {
1049
1049
  "backgroundColor": "transparent",
1050
1050
  "color": "#20303C",
1051
- "textAlign": "left",
1051
+ "writingDirection": "ltr",
1052
1052
  },
1053
1053
  undefined,
1054
1054
  {
@@ -1299,7 +1299,7 @@ exports[`AvatarScreen renders screen 1`] = `
1299
1299
  {
1300
1300
  "backgroundColor": "transparent",
1301
1301
  "color": "#20303C",
1302
- "textAlign": "left",
1302
+ "writingDirection": "ltr",
1303
1303
  },
1304
1304
  undefined,
1305
1305
  {
@@ -1501,7 +1501,7 @@ exports[`AvatarScreen renders screen 1`] = `
1501
1501
  {
1502
1502
  "backgroundColor": "transparent",
1503
1503
  "color": "#20303C",
1504
- "textAlign": "left",
1504
+ "writingDirection": "ltr",
1505
1505
  },
1506
1506
  undefined,
1507
1507
  {
@@ -1752,7 +1752,7 @@ exports[`AvatarScreen renders screen 1`] = `
1752
1752
  {
1753
1753
  "backgroundColor": "transparent",
1754
1754
  "color": "#20303C",
1755
- "textAlign": "left",
1755
+ "writingDirection": "ltr",
1756
1756
  },
1757
1757
  undefined,
1758
1758
  {
@@ -2047,7 +2047,7 @@ exports[`AvatarScreen renders screen 1`] = `
2047
2047
  {
2048
2048
  "backgroundColor": "transparent",
2049
2049
  "color": "#20303C",
2050
- "textAlign": "left",
2050
+ "writingDirection": "ltr",
2051
2051
  },
2052
2052
  undefined,
2053
2053
  {
@@ -2231,7 +2231,7 @@ exports[`AvatarScreen renders screen 1`] = `
2231
2231
  {
2232
2232
  "backgroundColor": "transparent",
2233
2233
  "color": "#20303C",
2234
- "textAlign": "left",
2234
+ "writingDirection": "ltr",
2235
2235
  },
2236
2236
  undefined,
2237
2237
  {
@@ -2338,7 +2338,7 @@ exports[`AvatarScreen renders screen 1`] = `
2338
2338
  {
2339
2339
  "backgroundColor": "transparent",
2340
2340
  "color": "#20303C",
2341
- "textAlign": "left",
2341
+ "writingDirection": "ltr",
2342
2342
  },
2343
2343
  undefined,
2344
2344
  undefined,
@@ -2457,7 +2457,7 @@ exports[`AvatarScreen renders screen 1`] = `
2457
2457
  {
2458
2458
  "backgroundColor": "transparent",
2459
2459
  "color": "#20303C",
2460
- "textAlign": "left",
2460
+ "writingDirection": "ltr",
2461
2461
  },
2462
2462
  undefined,
2463
2463
  {
@@ -2564,7 +2564,7 @@ exports[`AvatarScreen renders screen 1`] = `
2564
2564
  {
2565
2565
  "backgroundColor": "transparent",
2566
2566
  "color": "#20303C",
2567
- "textAlign": "left",
2567
+ "writingDirection": "ltr",
2568
2568
  },
2569
2569
  undefined,
2570
2570
  undefined,
@@ -2683,7 +2683,7 @@ exports[`AvatarScreen renders screen 1`] = `
2683
2683
  {
2684
2684
  "backgroundColor": "transparent",
2685
2685
  "color": "#20303C",
2686
- "textAlign": "left",
2686
+ "writingDirection": "ltr",
2687
2687
  },
2688
2688
  undefined,
2689
2689
  {
@@ -2867,7 +2867,7 @@ exports[`AvatarScreen renders screen 1`] = `
2867
2867
  {
2868
2868
  "backgroundColor": "transparent",
2869
2869
  "color": "#20303C",
2870
- "textAlign": "left",
2870
+ "writingDirection": "ltr",
2871
2871
  },
2872
2872
  undefined,
2873
2873
  {
@@ -2969,7 +2969,7 @@ exports[`AvatarScreen renders screen 1`] = `
2969
2969
  {
2970
2970
  "backgroundColor": "transparent",
2971
2971
  "color": "#20303C",
2972
- "textAlign": "left",
2972
+ "writingDirection": "ltr",
2973
2973
  },
2974
2974
  undefined,
2975
2975
  undefined,
@@ -3079,7 +3079,7 @@ exports[`AvatarScreen renders screen 1`] = `
3079
3079
  {
3080
3080
  "backgroundColor": "transparent",
3081
3081
  "color": "#20303C",
3082
- "textAlign": "left",
3082
+ "writingDirection": "ltr",
3083
3083
  },
3084
3084
  undefined,
3085
3085
  undefined,
@@ -1,10 +1,9 @@
1
1
  import _ from 'lodash';
2
2
  import React, {Component} from 'react';
3
3
  import {StyleSheet, ScrollView} from 'react-native';
4
- import {Colors, View, Text, ColorPicker, ColorPalette, ColorName} from 'react-native-ui-lib';
4
+ import {Colors, View, Text, ColorPicker, ColorPalette, ColorName, ColorInfo} from 'react-native-ui-lib';
5
5
  import {renderMultipleSegmentOptions} from '../ExampleScreenPresenter';
6
6
 
7
- interface Props {}
8
7
  interface State {
9
8
  color: string;
10
9
  textColor?: string;
@@ -14,6 +13,7 @@ interface State {
14
13
  }
15
14
 
16
15
  const INITIAL_COLOR = Colors.$backgroundPrimaryHeavy;
16
+ // prettier-ignore
17
17
  const colors = [
18
18
  '#20303C', '#43515C', '#66737C', '#858F96', '#A3ABB0', '#C2C7CB', '#E0E3E5', '#F2F4F5',
19
19
  '#3182C8', '#4196E0', '#459FED', '#57a8ef', '#8fc5f4', '#b5d9f8', '#daecfb', '#ecf5fd',
@@ -25,7 +25,7 @@ const colors = [
25
25
  '#8B1079', '#A0138E', '#B13DAC', '#C164BD', '#D08BCD', '#E0B1DE', '#EFD8EE', '#F7EBF7'
26
26
  ];
27
27
 
28
- export default class ColorPickerScreen extends Component<Props, State> {
28
+ export default class ColorPickerScreen extends Component<{}, State> {
29
29
  state: State = {
30
30
  color: INITIAL_COLOR,
31
31
  textColor: Colors.$textDefaultLight,
@@ -44,12 +44,12 @@ export default class ColorPickerScreen extends Component<Props, State> {
44
44
  this.setState({color, textColor, customColors: _.clone(customColors), paletteChange: false});
45
45
  };
46
46
 
47
- onValueChange = (value: string, options: object) => {
48
- this.setState({color: value, textColor: options ? _.get(options, 'tintColor') : undefined, paletteChange: false});
47
+ onValueChange = (value: string, colorInfo: ColorInfo) => {
48
+ this.setState({color: value, textColor: colorInfo?.tintColor, paletteChange: false});
49
49
  };
50
50
 
51
- onPaletteValueChange = (value: string, options: object) => {
52
- this.setState({color: value, textColor: options ? _.get(options, 'tintColor') : undefined, paletteChange: true});
51
+ onPaletteValueChange = (value: string, colorInfo: ColorInfo) => {
52
+ this.setState({color: value, textColor: colorInfo?.tintColor, paletteChange: true});
53
53
  };
54
54
 
55
55
  render() {
@@ -41,9 +41,6 @@ const NumberInputScreen = () => {
41
41
  case 'valid':
42
42
  newText = currentData.current.formattedNumber;
43
43
  break;
44
- case 'empty':
45
- newText = 'Empty';
46
- break;
47
44
  case 'error':
48
45
  newText = `Error: value '${currentData.current.userInput}' is invalid`;
49
46
  break;
@@ -73,18 +70,6 @@ const NumberInputScreen = () => {
73
70
  }
74
71
  }, [showLabel, exampleType]);
75
72
 
76
- const placeholder = useMemo(() => {
77
- switch (exampleType) {
78
- case 'price':
79
- default:
80
- return 'Price';
81
- case 'percentage':
82
- return 'Discount';
83
- case 'number':
84
- return 'Any number';
85
- }
86
- }, [exampleType]);
87
-
88
73
  const fractionDigits = useMemo(() => {
89
74
  switch (exampleType) {
90
75
  case 'price':
@@ -158,9 +143,26 @@ const NumberInputScreen = () => {
158
143
  }
159
144
  }, [exampleType]);
160
145
 
146
+ const textStyle = useMemo(() => {
147
+ return [styles.mainText, !leadingText && {marginLeft: Spacings.s4}, !trailingText && {marginRight: Spacings.s4}];
148
+ }, [leadingText, trailingText]);
149
+
150
+ const textFieldProps = useMemo(() => {
151
+ return {
152
+ label,
153
+ labelStyle: styles.label,
154
+ style: textStyle,
155
+ validate,
156
+ validationMessage,
157
+ validationMessageStyle: Typography.text80M,
158
+ validateOnChange: true,
159
+ centered: true
160
+ };
161
+ }, [label, textStyle, validate, validationMessage]);
162
+
161
163
  return (
162
- <TouchableWithoutFeedback onPress={RNKeyboard.dismiss}>
163
- <View flex centerH>
164
+ <TouchableWithoutFeedback style={{flex: 1}} onPress={RNKeyboard.dismiss}>
165
+ <View centerH flex>
164
166
  <Text text40 margin-s10>
165
167
  Number Input
166
168
  </Text>
@@ -174,30 +176,19 @@ const NumberInputScreen = () => {
174
176
  ],
175
177
  {state: exampleType, setState: setExampleType})}
176
178
 
177
- <View flex center>
179
+ <View marginT-50 centerH>
178
180
  <NumberInput
179
181
  key={exampleType}
180
- // initialNumber={100}
181
- label={label}
182
- labelStyle={styles.label}
183
- placeholder={placeholder}
182
+ // initialNumber={12.1}
183
+ // contextMenuHidden={false}
184
+ textFieldProps={textFieldProps}
184
185
  fractionDigits={fractionDigits}
185
186
  onChangeNumber={onChangeNumber}
186
187
  leadingText={leadingText}
187
188
  leadingTextStyle={leadingText && [styles.infoText, {marginLeft: Spacings.s4}]}
188
189
  trailingText={trailingText}
189
190
  trailingTextStyle={trailingText && [styles.infoText, {marginRight: Spacings.s4}]}
190
- style={[
191
- styles.mainText,
192
- !leadingText && {marginLeft: Spacings.s4},
193
- !trailingText && {marginRight: Spacings.s4}
194
- ]}
195
191
  containerStyle={styles.containerStyle}
196
- validate={validate}
197
- validationMessage={validationMessage}
198
- validationMessageStyle={Typography.text80M}
199
- validateOnChange
200
- centered
201
192
  />
202
193
  <Text marginT-s5>{text}</Text>
203
194
  </View>
@@ -1,5 +1,5 @@
1
1
  import React, {Component} from 'react';
2
- import {Animated, ScrollView} from 'react-native';
2
+ import {Alert, Animated, ScrollView} from 'react-native';
3
3
  import {View, Text, Colors} from 'react-native-ui-lib';
4
4
 
5
5
  class TextScreen extends Component {
@@ -85,6 +85,39 @@ class TextScreen extends Component {
85
85
  <Text text60R highlightString={['dancing', 'da']} highlightStyle={{color: Colors.green30}}>
86
86
  Dancing in The Dark
87
87
  </Text>
88
+ <Text
89
+ text60R
90
+ highlightString={{
91
+ string: 'Dancing',
92
+ onPress: () => Alert.alert('Dancing is pressed!'),
93
+ style: {color: Colors.blue10, backgroundColor: Colors.green50}
94
+ }}
95
+ highlightStyle={{color: Colors.green30}}
96
+ >
97
+ Dancing in The Dark
98
+ </Text>
99
+ <Text
100
+ text60R
101
+ highlightString={[
102
+ {
103
+ string: 'Dancing',
104
+ onPress: () => Alert.alert('Dancing is pressed!'),
105
+ style: {color: Colors.blue10, backgroundColor: Colors.green50}
106
+ },
107
+ {
108
+ string: 'laugh',
109
+ onPress: () => Alert.alert('laugh is pressed!'),
110
+ style: {color: Colors.red50, textDecorationLine: 'underline', textDecorationColor: Colors.blue30}
111
+ },
112
+ {
113
+ string: 'more',
114
+ onPress: () => Alert.alert('more is pressed!')
115
+ }
116
+ ]}
117
+ highlightStyle={{color: Colors.green30}}
118
+ >
119
+ Dancing in The Dark, laughing drinking and more
120
+ </Text>
88
121
  </View>
89
122
  {this.renderDivider()}
90
123
  <View padding-20 centerH>
@@ -6,7 +6,7 @@ import {renderBooleanOption} from '../ExampleScreenPresenter';
6
6
  const VALUE = 20;
7
7
  const NEGATIVE_VALUE = -30;
8
8
  const MIN = 0;
9
- const MAX = Constants.screenWidth - 40; // horizontal margins 20
9
+ const MAX = 350;
10
10
  const INITIAL_MIN = 30;
11
11
  const INITIAL_MAX = 270;
12
12
  const COLOR = Colors.blue30;