unicorn-demo-app 6.5.4 → 6.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
|
@@ -3,15 +3,14 @@ import {ScrollView} from 'react-native';
|
|
|
3
3
|
import {DateTimePicker, Text, TouchableOpacity, Colors} from 'react-native-ui-lib'; // eslint-disable-line
|
|
4
4
|
|
|
5
5
|
export default class DateTimePickerScreen extends Component {
|
|
6
|
-
|
|
7
|
-
getCustomInputValue = value => {
|
|
6
|
+
getCustomInputValue = (value: string) => {
|
|
8
7
|
if (!value) {
|
|
9
8
|
return 'Default';
|
|
10
9
|
}
|
|
11
|
-
return value.includes(new Date().getFullYear() + 1) ? 'Next Year' : value;
|
|
10
|
+
return value.includes((new Date().getFullYear() + 1).toString()) ? 'Next Year' : value;
|
|
12
11
|
};
|
|
13
12
|
|
|
14
|
-
renderCustomInput = (props, toggle) => {
|
|
13
|
+
renderCustomInput = (props: {value: string}, toggle: (shouldToggle: boolean) => void) => {
|
|
15
14
|
const {value} = props;
|
|
16
15
|
return (
|
|
17
16
|
<TouchableOpacity
|
|
@@ -23,7 +22,9 @@ export default class DateTimePickerScreen extends Component {
|
|
|
23
22
|
}}
|
|
24
23
|
>
|
|
25
24
|
<Text>Valid from</Text>
|
|
26
|
-
<Text absR color={Colors.primary} text80BO>
|
|
25
|
+
<Text absR color={Colors.primary} text80BO>
|
|
26
|
+
{this.getCustomInputValue(value)}
|
|
27
|
+
</Text>
|
|
27
28
|
</TouchableOpacity>
|
|
28
29
|
);
|
|
29
30
|
};
|
|
@@ -33,6 +34,7 @@ export default class DateTimePickerScreen extends Component {
|
|
|
33
34
|
<ScrollView style={{padding: 14}}>
|
|
34
35
|
<Text text40>Date Time Picker</Text>
|
|
35
36
|
<DateTimePicker
|
|
37
|
+
// @ts-expect-error
|
|
36
38
|
containerStyle={{marginVertical: 20}}
|
|
37
39
|
title={'Date'}
|
|
38
40
|
placeholder={'Select a date'}
|
|
@@ -9,6 +9,8 @@ const BROKEN_URL = 'file:///Desktop/website/img/cupcake.jpg';
|
|
|
9
9
|
const DEFAULT_SIZE = 100;
|
|
10
10
|
|
|
11
11
|
const file = Assets.svgs.demo.logo;
|
|
12
|
+
const uri = {uri: 'http://thenewcode.com/assets/images/thumbnails/homer-simpson.svg'};
|
|
13
|
+
const uriWithCss = {uri: 'http://thenewcode.com/assets/svg/accessibility.svg'};
|
|
12
14
|
const xml = `
|
|
13
15
|
<svg width="32" height="32" viewBox="0 0 32 32">
|
|
14
16
|
<path
|
|
@@ -38,6 +40,13 @@ enum SizeType {
|
|
|
38
40
|
Percentage = '50%'
|
|
39
41
|
}
|
|
40
42
|
|
|
43
|
+
enum SvgType {
|
|
44
|
+
File = 'file',
|
|
45
|
+
Uri = 'uri',
|
|
46
|
+
UriWithCss = 'use_with_css',
|
|
47
|
+
Xml = 'xml'
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
interface State {
|
|
42
51
|
cover: boolean;
|
|
43
52
|
showOverlayContent: boolean;
|
|
@@ -46,7 +55,7 @@ interface State {
|
|
|
46
55
|
margin: number;
|
|
47
56
|
showErrorImage: boolean;
|
|
48
57
|
showSvg: boolean;
|
|
49
|
-
|
|
58
|
+
svgType: SvgType;
|
|
50
59
|
sizeType: SizeType;
|
|
51
60
|
}
|
|
52
61
|
|
|
@@ -59,10 +68,25 @@ class ImageScreen extends Component<{}, State> {
|
|
|
59
68
|
margin: 0,
|
|
60
69
|
showErrorImage: false,
|
|
61
70
|
showSvg: false,
|
|
62
|
-
|
|
71
|
+
svgType: SvgType.File,
|
|
63
72
|
sizeType: SizeType.None
|
|
64
73
|
};
|
|
65
74
|
|
|
75
|
+
getSvgSource() {
|
|
76
|
+
const {svgType} = this.state;
|
|
77
|
+
switch (svgType) {
|
|
78
|
+
case SvgType.File:
|
|
79
|
+
return file;
|
|
80
|
+
case SvgType.Uri:
|
|
81
|
+
return uri;
|
|
82
|
+
case SvgType.UriWithCss:
|
|
83
|
+
return uriWithCss;
|
|
84
|
+
case SvgType.Xml:
|
|
85
|
+
default:
|
|
86
|
+
return xml;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
66
90
|
renderOverlayContent() {
|
|
67
91
|
const {cover, overlayType, showOverlayContent} = this.state;
|
|
68
92
|
if (showOverlayContent) {
|
|
@@ -105,14 +129,15 @@ class ImageScreen extends Component<{}, State> {
|
|
|
105
129
|
}
|
|
106
130
|
|
|
107
131
|
renderSvgImage() {
|
|
108
|
-
const {
|
|
132
|
+
const {sizeType} = this.state;
|
|
109
133
|
const size: any = Number(sizeType) || sizeType;
|
|
134
|
+
const source = this.getSvgSource();
|
|
110
135
|
return (
|
|
111
136
|
<>
|
|
112
137
|
{size ? (
|
|
113
|
-
<Image source={
|
|
138
|
+
<Image source={source} width={size} height={size}/>
|
|
114
139
|
) : (
|
|
115
|
-
<Image source={
|
|
140
|
+
<Image source={source}/>
|
|
116
141
|
)}
|
|
117
142
|
</>
|
|
118
143
|
);
|
|
@@ -134,10 +159,9 @@ class ImageScreen extends Component<{}, State> {
|
|
|
134
159
|
}
|
|
135
160
|
|
|
136
161
|
renderSvgOptions() {
|
|
137
|
-
const {isFile} = this.state;
|
|
138
162
|
return (
|
|
139
163
|
<>
|
|
140
|
-
{
|
|
164
|
+
{renderRadioGroup.call(this, 'SVG Type', 'svgType', SvgType, {isRow: true})}
|
|
141
165
|
{renderRadioGroup.call(this, 'Size Type', 'sizeType', SizeType, {isRow: true})}
|
|
142
166
|
</>
|
|
143
167
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, {Component} from 'react';
|
|
2
|
-
import {StyleSheet} from 'react-native';
|
|
2
|
+
import {StyleSheet, ModalProps} from 'react-native';
|
|
3
3
|
import {FlatList} from 'react-native-gesture-handler';
|
|
4
|
-
import {View, Text, Card, Button, Incubator, Colors, BorderRadiuses} from 'react-native-ui-lib'; //eslint-disable-line
|
|
4
|
+
import {View, Text, Card, Button, Incubator, Colors, BorderRadiuses, Constants} from 'react-native-ui-lib'; //eslint-disable-line
|
|
5
5
|
|
|
6
6
|
interface Item {
|
|
7
7
|
value: string;
|
|
@@ -33,10 +33,11 @@ const colors: Item[] = [
|
|
|
33
33
|
|
|
34
34
|
export default class IncubatorDialogScreen extends Component {
|
|
35
35
|
state = {visible: false};
|
|
36
|
+
modalProps: ModalProps = {supportedOrientations: ['portrait', 'landscape']};
|
|
36
37
|
|
|
37
38
|
renderVerticalItem = ({item}: {item: Item}) => {
|
|
38
39
|
return (
|
|
39
|
-
<Text text50 margin-20 color={item.value}>
|
|
40
|
+
<Text text50 margin-20 color={item.value} onPress={this.closeDialog}>
|
|
40
41
|
{item.label}
|
|
41
42
|
</Text>
|
|
42
43
|
);
|
|
@@ -54,6 +55,10 @@ export default class IncubatorDialogScreen extends Component {
|
|
|
54
55
|
this.setState({visible: false});
|
|
55
56
|
};
|
|
56
57
|
|
|
58
|
+
onDismiss = () => {
|
|
59
|
+
this.setState({visible: false});
|
|
60
|
+
};
|
|
61
|
+
|
|
57
62
|
render() {
|
|
58
63
|
const {visible} = this.state;
|
|
59
64
|
|
|
@@ -65,7 +70,14 @@ export default class IncubatorDialogScreen extends Component {
|
|
|
65
70
|
<View flex center>
|
|
66
71
|
<Button marginV-20 label="Open Dialog" onPress={this.openDialog}/>
|
|
67
72
|
</View>
|
|
68
|
-
<Incubator.Dialog
|
|
73
|
+
<Incubator.Dialog
|
|
74
|
+
useSafeArea
|
|
75
|
+
visible={visible}
|
|
76
|
+
onDismiss={this.onDismiss}
|
|
77
|
+
bottom
|
|
78
|
+
centerH
|
|
79
|
+
modalProps={this.modalProps}
|
|
80
|
+
>
|
|
69
81
|
<View style={styles.dialog}>
|
|
70
82
|
<Text text60 margin-s2>
|
|
71
83
|
Title (swipe here)
|
|
@@ -86,14 +98,11 @@ export default class IncubatorDialogScreen extends Component {
|
|
|
86
98
|
}
|
|
87
99
|
|
|
88
100
|
const styles = StyleSheet.create({
|
|
89
|
-
dialogContainer: {
|
|
90
|
-
bottom: 20,
|
|
91
|
-
alignSelf: 'center'
|
|
92
|
-
},
|
|
93
101
|
dialog: {
|
|
102
|
+
marginBottom: 20,
|
|
94
103
|
backgroundColor: Colors.white,
|
|
95
|
-
|
|
96
|
-
|
|
104
|
+
maxHeight: Constants.screenHeight * 0.8,
|
|
105
|
+
width: 300,
|
|
97
106
|
borderRadius: BorderRadiuses.br20
|
|
98
107
|
},
|
|
99
108
|
verticalScroll: {
|