unicorn-demo-app 6.24.0 → 6.25.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": "6.24.0",
3
+ "version": "6.25.0",
4
4
  "main": "src/index.js",
5
5
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
6
6
  "license": "MIT",
@@ -2,14 +2,15 @@ import _ from 'lodash';
2
2
  import React, {Component} from 'react';
3
3
  import {StyleSheet, ScrollView} from 'react-native';
4
4
  import {Colors, View, Text, ColorPicker, ColorPalette, ColorName} from 'react-native-ui-lib';
5
-
5
+ import {renderMultipleSegmentOptions} from '../ExampleScreenPresenter';
6
6
 
7
7
  interface Props {}
8
8
  interface State {
9
- color: string,
10
- textColor: string,
11
- customColors: string[],
12
- paletteChange: boolean
9
+ color: string;
10
+ textColor: string;
11
+ customColors: string[];
12
+ paletteChange: boolean;
13
+ backgroundColor: string;
13
14
  }
14
15
 
15
16
  const INITIAL_COLOR = Colors.$backgroundPrimaryHeavy;
@@ -24,37 +25,37 @@ const colors = [
24
25
  '#8B1079', '#A0138E', '#B13DAC', '#C164BD', '#D08BCD', '#E0B1DE', '#EFD8EE', '#F7EBF7'
25
26
  ];
26
27
 
27
-
28
28
  export default class ColorPickerScreen extends Component<Props, State> {
29
29
  state: State = {
30
30
  color: INITIAL_COLOR,
31
31
  textColor: Colors.$textDefaultLight,
32
32
  customColors: [],
33
- paletteChange: false
33
+ paletteChange: false,
34
+ backgroundColor: Colors.$backgroundDefault
34
35
  };
35
36
 
36
37
  onDismiss = () => {
37
38
  console.log(`screen onDismiss`);
38
- }
39
+ };
39
40
 
40
41
  onSubmit = (color: string, textColor: string) => {
41
42
  const {customColors} = this.state;
42
43
  customColors.push(color);
43
44
  this.setState({color, textColor, customColors: _.clone(customColors), paletteChange: false});
44
- }
45
+ };
45
46
 
46
47
  onValueChange = (value: string, options: object) => {
47
48
  this.setState({color: value, textColor: options ? _.get(options, 'tintColor') : undefined, paletteChange: false});
48
- }
49
+ };
49
50
 
50
51
  onPaletteValueChange = (value: string, options: object) => {
51
52
  this.setState({color: value, textColor: options ? _.get(options, 'tintColor') : undefined, paletteChange: true});
52
- }
53
+ };
53
54
 
54
55
  render() {
55
- const {color, textColor, customColors, paletteChange} = this.state;
56
- const paletteValue = paletteChange ? (color || INITIAL_COLOR) : undefined;
57
- const pickerValue = !paletteChange ? (color || INITIAL_COLOR) : undefined;
56
+ const {color, textColor, customColors, paletteChange, backgroundColor} = this.state;
57
+ const paletteValue = paletteChange ? color || INITIAL_COLOR : undefined;
58
+ const pickerValue = !paletteChange ? color || INITIAL_COLOR : undefined;
58
59
 
59
60
  const mappedColor = ColorName.name(color);
60
61
  const nearestColor = mappedColor[0];
@@ -67,18 +68,30 @@ export default class ColorPickerScreen extends Component<Props, State> {
67
68
  <Text text60 margin-10 style={{color}}>
68
69
  Selected Color: {color}
69
70
  </Text>
70
- <View center marginB-10 style={{height: 50, width: 200, backgroundColor: color}} >
71
+ <View center marginB-10 style={{height: 50, width: 200, backgroundColor: color}}>
71
72
  <Text text60 style={{color: textColor}}>
72
73
  {color}
73
74
  </Text>
74
75
  </View>
75
76
  </View>
76
77
  <View bg-$backgroundDefault>
78
+ <View marginH-20>
79
+ {renderMultipleSegmentOptions.call(this, 'backgroundColor:', 'backgroundColor', [
80
+ {label: 'Default', value: Colors.$backgroundDefault},
81
+ {label: 'Primary', value: Colors.$backgroundPrimaryHeavy},
82
+ {label: 'Success', value: Colors.$backgroundSuccessHeavy}
83
+ ])}
84
+ </View>
77
85
  <Text text60 marginL-20 marginB-4 marginT-24>
78
86
  Theme Color
79
87
  </Text>
80
88
  <Text marginL-20>Choose a color for your place’s theme.</Text>
81
- <ColorPalette value={paletteValue} onValueChange={this.onPaletteValueChange} colors={colors}/>
89
+ <ColorPalette
90
+ value={paletteValue}
91
+ onValueChange={this.onPaletteValueChange}
92
+ colors={colors}
93
+ backgroundColor={backgroundColor}
94
+ />
82
95
  <Text marginL-20 marginT-16>
83
96
  Custom Colors
84
97
  </Text>
@@ -90,6 +103,7 @@ export default class ColorPickerScreen extends Component<Props, State> {
90
103
  onValueChange={this.onValueChange}
91
104
  value={pickerValue}
92
105
  // animatedIndex={0}
106
+ backgroundColor={backgroundColor}
93
107
  />
94
108
  </View>
95
109
 
@@ -153,7 +153,7 @@ class GridViewScreen extends Component {
153
153
  items={contacts}
154
154
  // viewWidth={300}
155
155
  numColumns={6}
156
- lastItemOverlayColor={Colors.rgba(Colors.primary, 0.6)}
156
+ lastItemOverlayColor={Colors.rgba(Colors.$backgroundPrimaryHeavy, 0.6)}
157
157
  lastItemLabel={7}
158
158
  />
159
159
 
@@ -163,7 +163,7 @@ class GridViewScreen extends Component {
163
163
  <GridView
164
164
  items={products}
165
165
  numColumns={4}
166
- lastItemOverlayColor={Colors.rgba(Colors.primary, 0.6)}
166
+ lastItemOverlayColor={Colors.rgba(Colors.$backgroundPrimaryHeavy, 0.6)}
167
167
  lastItemLabel={42}
168
168
  keepItemSize
169
169
  />
@@ -1,6 +1,5 @@
1
- import _ from 'lodash';
2
1
  import React, {Component} from 'react';
3
- import {StyleSheet} from 'react-native';
2
+ import {StyleSheet, ScrollView} from 'react-native';
4
3
  import {Marquee, MarqueeDirections, Text, View, Spacings} from 'react-native-ui-lib';
5
4
  import {renderBooleanOption, renderMultipleSegmentOptions} from '../ExampleScreenPresenter';
6
5
 
@@ -61,7 +60,7 @@ export default class MarqueeScreen extends Component<{}> {
61
60
 
62
61
  render() {
63
62
  return (
64
- <View flex padding-page>
63
+ <ScrollView style={styles.container}>
65
64
  <Text h1 center margin-20 $textDefault>
66
65
  Marquee
67
66
  </Text>
@@ -84,12 +83,16 @@ export default class MarqueeScreen extends Component<{}> {
84
83
  </View>
85
84
  {this.renderHorizontalSection()}
86
85
  {this.renderVerticalSection()}
87
- </View>
86
+ </ScrollView>
88
87
  );
89
88
  }
90
89
  }
91
90
 
92
91
  const styles = StyleSheet.create({
92
+ container: {
93
+ flex: 1,
94
+ padding: 20
95
+ },
93
96
  containerHorizontal: {
94
97
  borderWidth: 1,
95
98
  borderColor: 'black',