unicorn-demo-app 7.23.5 → 7.24.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.23.5",
3
+ "version": "7.24.0",
4
4
  "main": "src/index.js",
5
5
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
6
6
  "license": "MIT",
@@ -1,7 +1,32 @@
1
- import {Colors, Typography, Spacings, TextField} from 'react-native-ui-lib'; // eslint-disable-line
1
+ import {Assets, Colors, Typography, Spacings, TextField} from 'react-native-ui-lib'; // eslint-disable-line
2
2
 
3
3
  export const loadDemoConfigurations = () => {
4
- require('./assets/Assets');
4
+ Assets.loadAssetsGroup('icons.demo', {
5
+ chevronDown: require('./assets/icons/chevronDown.png'),
6
+ chevronRight: require('./assets/icons/chevronRight.png'),
7
+ add: require('./assets/icons/add.png'),
8
+ camera: require('./assets/icons/cameraSelected.png'),
9
+ close: require('./assets/icons/close.png'),
10
+ dashboard: require('./assets/icons/dashboard.png'),
11
+ drag: require('./assets/icons/drag.png'),
12
+ image: require('./assets/icons/image.png'),
13
+ plus: require('./assets/icons/plus.png'),
14
+ refresh: require('./assets/icons/refresh.png'),
15
+ search: require('./assets/icons/search.png'),
16
+ settings: require('./assets/icons/settings.png'),
17
+ share: require('./assets/icons/share.png'),
18
+ info: require('./assets/icons/info.png'),
19
+ exclamation: require('./assets/icons/exclamationFillSmall.png')
20
+ });
21
+
22
+ Assets.loadAssetsGroup('images.demo', {
23
+ brokenImage: require('./assets/images/placeholderMissingImage.png')
24
+ });
25
+
26
+ Assets.loadAssetsGroup('svgs.demo', {
27
+ logo: require('./assets/svgs/headerLogo.svg').default
28
+ });
29
+
5
30
  Typography.loadTypographies({
6
31
  h1: {...Typography.text40},
7
32
  h2: {...Typography.text50},
package/src/demoApp.js CHANGED
@@ -14,17 +14,6 @@ import Storage, {DEFAULT_SCREEN} from './storage';
14
14
  // gold: '#FFD700',
15
15
  // });
16
16
 
17
- // ThemeManager.setComponentTheme('Picker', (props) => {
18
- // if (props.useNativePicker) {
19
- // return {
20
- // topBarProps: {
21
- // doneLabel: Constants.isIOS ? 'Done2' : 'OK2',
22
- // cancelLabel: Constants.isIOS ? 'Cancel2' : 'CANCEL2',
23
- // },
24
- // };
25
- // }
26
- // });
27
-
28
17
  // const customAnimationsDefinitions = {
29
18
  // customAnimation1: {
30
19
  // from: {opacity: 0, translateY: 20},
@@ -45,6 +45,10 @@ export default class ChipsInputScreen extends Component {
45
45
 
46
46
  this.setState({chips: newChips});
47
47
  }}
48
+ validate={'required'}
49
+ validateOnChange
50
+ validationMessage={'You must add at least one chip'}
51
+ marginB-10
48
52
  />
49
53
 
50
54
  <ChipsInput
@@ -1,9 +1,8 @@
1
1
  import React, {Component} from 'react';
2
2
  import {StyleSheet, ScrollView, LayoutAnimation} from 'react-native';
3
- import {Colors, Typography, View, Drawer, Text, Button, Avatar, Badge, DrawerProps} from 'react-native-ui-lib';
3
+ import {Assets, Colors, Typography, View, Drawer, Text, Button, Avatar, Badge, DrawerProps} from 'react-native-ui-lib';
4
4
  import {gestureHandlerRootHOC} from 'react-native-gesture-handler';
5
5
  import conversations from '../../data/conversations';
6
- import Assets from '../../assets/Assets';
7
6
 
8
7
  import {renderBooleanOption, renderSliderOption, renderColorOption} from '../ExampleScreenPresenter';
9
8
 
@@ -1,9 +1,8 @@
1
1
  import _ from 'lodash';
2
2
  import React, {Component} from 'react';
3
3
  import {Alert, ViewStyle} from 'react-native';
4
- import {Colors, View, Text, Hint, Button, Incubator} from 'react-native-ui-lib';
4
+ import {Colors, View, Text, Hint, Button, Assets, Incubator} from 'react-native-ui-lib';
5
5
  import {renderMultipleSegmentOptions, renderBooleanOption} from '../ExampleScreenPresenter';
6
- import Assets from '../../assets/Assets';
7
6
 
8
7
  const settingsIcon = require('../../assets/icons/settings.png');
9
8
  const reactions = ['❤️', '😮', '😔', '😂', '😡'];
@@ -1,8 +1,7 @@
1
1
  import React, {Component} from 'react';
2
2
  import {ScrollView} from 'react-native';
3
- import {View, Text, Icon, Image, Colors, OverlayTypes} from 'react-native-ui-lib';
3
+ import {View, Text, Icon, Image, Colors, Assets, OverlayTypes} from 'react-native-ui-lib';
4
4
  import {renderBooleanOption, renderRadioGroup, renderSliderOption} from '../ExampleScreenPresenter';
5
- import Assets from '../../assets/Assets';
6
5
 
7
6
  const IMAGE_URL =
8
7
  'https://images.pexels.com/photos/748837/pexels-photo-748837.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260';
@@ -1,8 +1,7 @@
1
1
  import React, {Component} from 'react';
2
2
  import {Alert, StyleSheet} from 'react-native';
3
3
  import {Navigation} from 'react-native-navigation';
4
- import {Colors, Carousel, PageControl, Modal, View, Text} from 'react-native-ui-lib'; // eslint-disable-line
5
- import Assets from '../../assets/Assets';
4
+ import {Colors, Carousel, PageControl, Modal, View, Text, Assets} from 'react-native-ui-lib'; // eslint-disable-line
6
5
 
7
6
  const BUTTONS_HIT_SLOP = {right: 5, left: 5, top: 10, bottom: 10};
8
7
  interface ModalScreenProps {
@@ -91,7 +91,7 @@ export default class PickerScreen extends Component {
91
91
  language2: options[2].value,
92
92
  languages: [],
93
93
  option: undefined,
94
- nativePickerValue: 'java',
94
+ wheelPickerValue: 'java',
95
95
  dialogPickerValue: 'java',
96
96
  customModalValues: [],
97
97
  filter: filters[0].value,
@@ -157,8 +157,8 @@ export default class PickerScreen extends Component {
157
157
  label="Wheel Picker"
158
158
  placeholder="Pick a Language"
159
159
  useWheelPicker
160
- value={this.state.nativePickerValue}
161
- onChange={nativePickerValue => this.setState({nativePickerValue})}
160
+ value={this.state.wheelPickerValue}
161
+ onChange={wheelPickerValue => this.setState({wheelPickerValue})}
162
162
  trailingAccessory={<Icon source={dropdown}/>}
163
163
  items={options}
164
164
  />
@@ -8,10 +8,10 @@ import {
8
8
  TouchableOpacity,
9
9
  Text,
10
10
  Icon,
11
+ Assets,
11
12
  Colors,
12
13
  Button
13
14
  } from 'react-native-ui-lib';
14
- import Assets from '../../assets/Assets';
15
15
  import {renderHeader} from '../ExampleScreenPresenter';
16
16
 
17
17
  interface Item extends SortableListItemProps {
@@ -2,6 +2,7 @@ import _ from 'lodash';
2
2
  import React, {Component} from 'react';
3
3
  import {ActivityIndicator, StyleSheet} from 'react-native';
4
4
  import {
5
+ Assets,
5
6
  TabController,
6
7
  Colors,
7
8
  View,
@@ -11,7 +12,6 @@ import {
11
12
  TabControllerImperativeMethods
12
13
  } from 'react-native-ui-lib';
13
14
  import {gestureHandlerRootHOC} from 'react-native-gesture-handler';
14
- import Assets from '../../../assets/Assets';
15
15
 
16
16
  import Tab1 from './tab1';
17
17
  import Tab2 from './tab2';
@@ -1,6 +1,7 @@
1
1
  import React, {Component} from 'react';
2
2
  import {ScrollView, ActivityIndicator} from 'react-native';
3
3
  import {
4
+ Assets,
4
5
  Colors,
5
6
  Spacings,
6
7
  View,
@@ -11,12 +12,11 @@ import {
11
12
  TextFieldRef,
12
13
  FieldContextType,
13
14
  TextFieldProps,
14
- SegmentedControl
15
+ SegmentedControl,
16
+ Icon
15
17
  } from 'react-native-ui-lib';
16
- import Assets from '../../assets/Assets';
17
18
  const {KeyboardAwareInsetsView} = Keyboard;
18
19
  const priceFormatter = Intl.NumberFormat('en-US');
19
- const validationIcon = require('../../assets/icons/exclamationFillSmall.png');
20
20
 
21
21
  export default class TextFieldScreen extends Component {
22
22
  input = React.createRef<TextFieldRef>();
@@ -167,7 +167,7 @@ export default class TextFieldScreen extends Component {
167
167
  };
168
168
 
169
169
  renderValidationExample() {
170
- const {errorPosition} = this.state;
170
+ const {errorPosition, preset} = this.state;
171
171
 
172
172
  return (
173
173
  <>
@@ -178,7 +178,7 @@ export default class TextFieldScreen extends Component {
178
178
  <SegmentedControl segments={[{label: 'Bottom'}, {label: 'Top'}]} onChangeIndex={this.onChangeIndexValidation}/>
179
179
  </View>
180
180
  </View>
181
-
181
+
182
182
  <TextField
183
183
  value={this.state.value}
184
184
  onChangeText={value => this.setState({value})}
@@ -204,7 +204,9 @@ export default class TextFieldScreen extends Component {
204
204
  containerStyle={{flex: 1}}
205
205
  validationMessagePosition={errorPosition}
206
206
  helperText={'Enter first and last name'}
207
- validationIcon={{source: validationIcon, style: {marginTop: 1}}}
207
+ validationIcon={{source: Assets.icons.demo.exclamation, style: {marginTop: 1}}}
208
+ topTrailingAccessory={<Icon source={Assets.icons.demo.info} size={16}/>}
209
+ preset={preset}
208
210
  />
209
211
  <Button
210
212
  outline
@@ -351,6 +353,26 @@ export default class TextFieldScreen extends Component {
351
353
  );
352
354
  }
353
355
 
356
+ renderClearButtonExample() {
357
+ return (
358
+ <>
359
+ <Text h3 marginB-s3>
360
+ Clear Button
361
+ </Text>
362
+
363
+ <TextField
364
+ label="Description"
365
+ placeholder="Enter text..."
366
+ showClearButton
367
+ value={this.state.value}
368
+ onChangeText={value => this.setState({value})}
369
+ trailingAccessory={<Icon source={Assets.icons.demo.search}/>}
370
+ // multiline
371
+ />
372
+ </>
373
+ );
374
+ }
375
+
354
376
  renderHintExample() {
355
377
  return (
356
378
  <>
@@ -400,7 +422,16 @@ export default class TextFieldScreen extends Component {
400
422
  </Text>
401
423
 
402
424
  <Text marginB-s1 $textPrimary>Centered:</Text>
403
- <TextField label="PIN" placeholder="XXXX" centered/>
425
+ <TextField
426
+ label="PIN"
427
+ placeholder="XXXX"
428
+ centered
429
+ topTrailingAccessory={<Icon source={Assets.icons.demo.info} size={16}/>}
430
+ validate={'required'}
431
+ validationMessage={'This field is required'}
432
+ validateOnBlur
433
+ validationMessagePosition={this.state.errorPosition}
434
+ />
404
435
 
405
436
  <Text marginB-s1 $textPrimary>Inline:</Text>
406
437
  <View row>
@@ -414,8 +445,8 @@ export default class TextFieldScreen extends Component {
414
445
 
415
446
  render() {
416
447
  return (
417
- <ScrollView keyboardShouldPersistTaps="always" showsVerticalScrollIndicator={false}>
418
- <View flex padding-page>
448
+ <ScrollView showsVerticalScrollIndicator={false} keyboardShouldPersistTaps="always">
449
+ <View padding-page>
419
450
  <Text h1 marginB-s4>TextField</Text>
420
451
 
421
452
  {this.renderDefaultExample()}
@@ -423,6 +454,7 @@ export default class TextFieldScreen extends Component {
423
454
  {this.renderPlaceholdersExample()}
424
455
  {this.renderValidationExample()}
425
456
  {this.renderHintExample()}
457
+ {this.renderClearButtonExample()}
426
458
  {this.renderCherCounterExample()}
427
459
  {this.renderAccessoriesExample()}
428
460
  {this.renderStateColorsExample()}
@@ -1,7 +1,7 @@
1
1
  import React, {useCallback, useRef, useState} from 'react';
2
2
  import {StyleSheet, ScrollView} from 'react-native';
3
- import {Colors, Timeline, View, Card, Text, Button} from 'react-native-ui-lib';
4
- import Assets from '../../assets/Assets';
3
+ import {Assets, Colors, Timeline, View, Card, Text, Button} from 'react-native-ui-lib';
4
+
5
5
  const contents = [
6
6
  'CURRENT (default) state with dashed line.\nAligned to title',
7
7
  'SUCCESS state with label.',
@@ -1,9 +1,9 @@
1
1
  import React, {Component} from 'react';
2
2
  import {ScrollView, StyleSheet} from 'react-native';
3
- import {Colors, View, Button, Text, Incubator} from 'react-native-ui-lib';
3
+ import {Assets, Colors, View, Button, Text, Incubator} from 'react-native-ui-lib';
4
4
  import {renderMultipleSegmentOptions, renderBooleanOption, renderRadioGroup} from '../ExampleScreenPresenter';
5
5
  import {gestureHandlerRootHOC} from 'react-native-gesture-handler';
6
- import Assets from '../../assets/Assets';
6
+
7
7
  const {Toast} = Incubator;
8
8
 
9
9
  const TOAST_ACTIONS = {
@@ -2,6 +2,7 @@ import React, {Component} from 'react';
2
2
  import {StyleSheet, ScrollView} from 'react-native';
3
3
  import {GestureHandlerRootView, FlatList} from 'react-native-gesture-handler';
4
4
  import {
5
+ Assets,
5
6
  View,
6
7
  Text,
7
8
  Colors,
@@ -14,7 +15,7 @@ import {
14
15
  TouchableOpacity
15
16
  } from 'react-native-ui-lib';
16
17
  const {PanView} = Incubator;
17
- import Assets from '../../assets/Assets';
18
+
18
19
  interface Item {
19
20
  value: string;
20
21
  label: string;
@@ -1,8 +1,7 @@
1
1
  import React, {Component} from 'react';
2
2
  import {StyleSheet, ScrollView} from 'react-native';
3
- import {Colors, Spacings, View, Card, Text, Image, Button, Constants} from 'react-native-ui-lib';
3
+ import {Assets, Colors, Spacings, View, Card, Text, Image, Button, Constants} from 'react-native-ui-lib';
4
4
  import _ from 'lodash';
5
- import Assets from '../../../assets/Assets';
6
5
 
7
6
  import './configurations';
8
7
 
@@ -1,8 +1,7 @@
1
1
  import React, {Component} from 'react';
2
2
  import {ScrollView} from 'react-native';
3
- import {View, Text, Icon, Colors, Image, Button, Carousel, Picker, PickerValue} from 'react-native-ui-lib';
3
+ import {Assets, View, Text, Icon, Colors, Image, Button, Carousel, Picker, PickerValue} from 'react-native-ui-lib';
4
4
  import _ from 'lodash';
5
- import Assets from '../../../assets/Assets';
6
5
 
7
6
  const colorOptions = [
8
7
  {label: 'Red', value: 'red', color: Colors.red30},
@@ -1,25 +0,0 @@
1
- import {Assets} from 'react-native-ui-lib';
2
- Assets.loadAssetsGroup('icons.demo', {
3
- chevronDown: require('./icons/chevronDown.png'),
4
- chevronRight: require('./icons/chevronRight.png'),
5
- add: require('./icons/add.png'),
6
- camera: require('./icons/cameraSelected.png'),
7
- close: require('./icons/close.png'),
8
- dashboard: require('./icons/dashboard.png'),
9
- drag: require('./icons/drag.png'),
10
- image: require('./icons/image.png'),
11
- plus: require('./icons/plus.png'),
12
- refresh: require('./icons/refresh.png'),
13
- search: require('./icons/search.png'),
14
- settings: require('./icons/settings.png'),
15
- share: require('./icons/share.png')
16
- });
17
-
18
- Assets.loadAssetsGroup('images.demo', {
19
- brokenImage: require('./images/placeholderMissingImage.png')
20
- });
21
-
22
- Assets.loadAssetsGroup('svgs.demo', {
23
- logo: require('./svgs/headerLogo.svg').default
24
- });
25
- export default Assets as typeof Assets;