unicorn-demo-app 7.44.0-snapshot.7216 → 7.44.0-snapshot.7228

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.44.0-snapshot.7216",
3
+ "version": "7.44.0-snapshot.7228",
4
4
  "main": "src/index.js",
5
5
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
6
6
  "license": "MIT",
package/src/index.js CHANGED
@@ -86,15 +86,6 @@ module.exports = {
86
86
  get PageControlScreen() {
87
87
  return require('./screens/componentScreens/PageControlScreen').default;
88
88
  },
89
- get PanDismissibleScreen() {
90
- return require('./screens/componentScreens/PanDismissibleScreen').default;
91
- },
92
- get PanListenerScreen() {
93
- return require('./screens/componentScreens/PanListenerScreen').default;
94
- },
95
- get PanResponderScreen() {
96
- return require('./screens/componentScreens/PanResponderScreen').default;
97
- },
98
89
  get PickerScreen() {
99
90
  return require('./screens/componentScreens/PickerScreen').default;
100
91
  },
@@ -107,9 +98,6 @@ module.exports = {
107
98
  get SegmentedControlScreen() {
108
99
  return require('./screens/componentScreens/SegmentedControlScreen').default;
109
100
  },
110
- get SharedTransitionScreen() {
111
- return require('./screens/componentScreens/SharedTransitionScreen').default;
112
- },
113
101
  get SkeletonViewScreen() {
114
102
  return require('./screens/componentScreens/SkeletonViewScreen').default;
115
103
  },
@@ -243,16 +231,13 @@ module.exports = {
243
231
  get SortableGridList() {
244
232
  return require('./screens/componentScreens/SortableGridListScreen').default;
245
233
  },
246
- // Incubator
247
234
  get PanViewScreen() {
248
- return require('./screens/incubatorScreens/PanViewScreen').default;
235
+ return require('./screens/componentScreens/PanViewScreen').default;
249
236
  },
237
+ // Incubator
250
238
  get IncubatorSlider() {
251
239
  return require('./screens/incubatorScreens/IncubatorSliderScreen').default;
252
240
  },
253
- get IncubatorDialog() {
254
- return require('./screens/incubatorScreens/IncubatorDialogScreen').default;
255
- },
256
241
  get IncubatorToast() {
257
242
  return require('./screens/incubatorScreens/IncubatorToastScreen').default;
258
243
  },
@@ -39,11 +39,6 @@ export const navigationData = {
39
39
  {title: 'ProgressBar', tags: 'progress bar animated', screen: 'unicorn.animations.ProgressBarScreen'},
40
40
  {title: 'ScrollBar', tags: 'scroll bar gradient', screen: 'unicorn.components.ScrollBarScreen'},
41
41
  {title: 'SearchInputScreen', tags: 'search input', screen: 'unicorn.components.SearchInputScreen'},
42
- {
43
- title: 'Shared Transition',
44
- tags: 'shared transition element',
45
- screen: 'unicorn.components.SharedTransitionScreen'
46
- },
47
42
  {title: 'Stack Aggregator', tags: 'stack aggregator', screen: 'unicorn.components.StackAggregatorScreen'},
48
43
  {title: 'Marquee', tags: 'sliding text', screen: 'unicorn.components.MarqueeScreen'}
49
44
  ]
@@ -183,16 +178,14 @@ export const navigationData = {
183
178
  title: 'Animations & Gestures',
184
179
  screens: [
185
180
  {title: 'Animated Image', tags: 'animated image', screen: 'unicorn.components.AnimatedImageScreen'},
181
+ {title: 'Card Scanner', tags: 'card scanner process', screen: 'unicorn.animations.CardScannerScreen'},
186
182
  {title: 'Haptic feedback', tags: 'haptic feedback', screen: 'unicorn.components.HapticScreen'},
183
+ {title: 'PanView', tags: 'pan swipe drag', screen: 'unicorn.components.PanViewScreen'},
187
184
  {
188
185
  title: 'ProgressiveImage',
189
186
  tags: 'progressive image cover overlay',
190
187
  screen: 'unicorn.components.ProgressiveImageScreen'
191
- },
192
- {title: 'Card Scanner', tags: 'card scanner process', screen: 'unicorn.animations.CardScannerScreen'},
193
- {title: 'Pan Dismissible', tags: 'pan swipe drag dismiss', screen: 'unicorn.components.PanDismissibleScreen'},
194
- {title: 'Pan Listener', tags: 'pan swipe drag listener', screen: 'unicorn.components.PanListenerScreen'},
195
- {title: 'Pan Responder', tags: 'pan swipe drag responder', screen: 'unicorn.components.PanResponderScreen'}
188
+ }
196
189
  ]
197
190
  },
198
191
  Incubator: {
@@ -206,8 +199,7 @@ export const navigationData = {
206
199
  title: 'ExpandableOverlay',
207
200
  tags: 'text field expandable input picker',
208
201
  screen: 'unicorn.components.IncubatorExpandableOverlayScreen'
209
- },
210
- {title: 'PanView', tags: 'pan swipe drag', screen: 'unicorn.incubator.PanViewScreen'}
202
+ }
211
203
  ]
212
204
  },
213
205
  Inspirations: {
@@ -728,7 +728,7 @@ exports[`TextField Screen renders screen 1`] = `
728
728
  },
729
729
  undefined,
730
730
  {
731
- "color": "#FC3D2F",
731
+ "color": "#D52712",
732
732
  },
733
733
  undefined,
734
734
  undefined,
@@ -1269,7 +1269,7 @@ exports[`TextField Screen renders screen 1`] = `
1269
1269
  },
1270
1270
  undefined,
1271
1271
  {
1272
- "color": "#FC3D2F",
1272
+ "color": "#D52712",
1273
1273
  },
1274
1274
  undefined,
1275
1275
  undefined,
@@ -1657,7 +1657,7 @@ exports[`TextField Screen renders screen 1`] = `
1657
1657
  },
1658
1658
  undefined,
1659
1659
  {
1660
- "color": "#FC3D2F",
1660
+ "color": "#D52712",
1661
1661
  },
1662
1662
  undefined,
1663
1663
  undefined,
@@ -1888,7 +1888,7 @@ exports[`TextField Screen renders screen 1`] = `
1888
1888
  },
1889
1889
  undefined,
1890
1890
  {
1891
- "color": "#FC3D2F",
1891
+ "color": "#D52712",
1892
1892
  },
1893
1893
  undefined,
1894
1894
  undefined,
@@ -2275,7 +2275,7 @@ exports[`TextField Screen renders screen 1`] = `
2275
2275
  },
2276
2276
  undefined,
2277
2277
  {
2278
- "color": "#FC3D2F",
2278
+ "color": "#D52712",
2279
2279
  },
2280
2280
  undefined,
2281
2281
  undefined,
@@ -3192,7 +3192,7 @@ exports[`TextField Screen renders screen 1`] = `
3192
3192
  },
3193
3193
  undefined,
3194
3194
  {
3195
- "color": "#FC3D2F",
3195
+ "color": "#D52712",
3196
3196
  },
3197
3197
  undefined,
3198
3198
  undefined,
@@ -4089,7 +4089,7 @@ exports[`TextField Screen renders screen 1`] = `
4089
4089
  },
4090
4090
  undefined,
4091
4091
  {
4092
- "color": "#FC3D2F",
4092
+ "color": "#D52712",
4093
4093
  },
4094
4094
  undefined,
4095
4095
  undefined,
@@ -4792,7 +4792,7 @@ exports[`TextField Screen renders screen 1`] = `
4792
4792
  },
4793
4793
  undefined,
4794
4794
  {
4795
- "color": "#FC3D2F",
4795
+ "color": "#D52712",
4796
4796
  },
4797
4797
  undefined,
4798
4798
  undefined,
@@ -5052,7 +5052,7 @@ exports[`TextField Screen renders screen 1`] = `
5052
5052
  },
5053
5053
  undefined,
5054
5054
  {
5055
- "color": "#FC3D2F",
5055
+ "color": "#D52712",
5056
5056
  },
5057
5057
  undefined,
5058
5058
  undefined,
@@ -5342,7 +5342,7 @@ exports[`TextField Screen renders screen 1`] = `
5342
5342
  },
5343
5343
  undefined,
5344
5344
  {
5345
- "color": "#FC3D2F",
5345
+ "color": "#D52712",
5346
5346
  },
5347
5347
  undefined,
5348
5348
  undefined,
@@ -6083,7 +6083,7 @@ exports[`TextField Screen renders screen 1`] = `
6083
6083
  },
6084
6084
  undefined,
6085
6085
  {
6086
- "color": "#FC3D2F",
6086
+ "color": "#D52712",
6087
6087
  },
6088
6088
  undefined,
6089
6089
  undefined,
@@ -6384,7 +6384,7 @@ exports[`TextField Screen renders screen 1`] = `
6384
6384
  },
6385
6385
  undefined,
6386
6386
  {
6387
- "color": "#FC3D2F",
6387
+ "color": "#D52712",
6388
6388
  },
6389
6389
  undefined,
6390
6390
  undefined,
@@ -6713,7 +6713,7 @@ exports[`TextField Screen renders screen 1`] = `
6713
6713
  },
6714
6714
  undefined,
6715
6715
  {
6716
- "color": "#FC3D2F",
6716
+ "color": "#D52712",
6717
6717
  },
6718
6718
  undefined,
6719
6719
  undefined,
@@ -7089,7 +7089,7 @@ exports[`TextField Screen renders screen 1`] = `
7089
7089
  },
7090
7090
  undefined,
7091
7091
  {
7092
- "color": "#FC3D2F",
7092
+ "color": "#D52712",
7093
7093
  },
7094
7094
  undefined,
7095
7095
  undefined,
@@ -7365,7 +7365,7 @@ exports[`TextField Screen renders screen 1`] = `
7365
7365
  },
7366
7366
  undefined,
7367
7367
  {
7368
- "color": "#FC3D2F",
7368
+ "color": "#D52712",
7369
7369
  },
7370
7370
  undefined,
7371
7371
  undefined,
@@ -7620,7 +7620,7 @@ exports[`TextField Screen renders screen 1`] = `
7620
7620
  },
7621
7621
  undefined,
7622
7622
  {
7623
- "color": "#FC3D2F",
7623
+ "color": "#D52712",
7624
7624
  },
7625
7625
  undefined,
7626
7626
  undefined,
@@ -7910,7 +7910,7 @@ exports[`TextField Screen renders screen 1`] = `
7910
7910
  },
7911
7911
  undefined,
7912
7912
  {
7913
- "color": "#FC3D2F",
7913
+ "color": "#D52712",
7914
7914
  },
7915
7915
  undefined,
7916
7916
  undefined,
@@ -64,7 +64,6 @@ export default class ActionSheetScreen extends Component {
64
64
  cancelButtonIndex={3}
65
65
  destructiveButtonIndex={0}
66
66
  useNativeIOS={false}
67
- migrateDialog
68
67
  options={[
69
68
  {label: 'option 1', onPress: () => this.pickOption('option 1')},
70
69
  {label: 'option 2', onPress: () => this.pickOption('option 2')},
@@ -80,7 +79,6 @@ export default class ActionSheetScreen extends Component {
80
79
  message={'Message of action sheet'}
81
80
  cancelButtonIndex={3}
82
81
  destructiveButtonIndex={0}
83
- migrateDialog
84
82
  options={[
85
83
  {label: 'option 1', onPress: () => this.pickOption('option 1'), iconSource: collectionsIcon},
86
84
  {label: 'option 2', onPress: () => this.pickOption('option 2'), iconSource: shareIcon},
@@ -62,7 +62,6 @@ 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
66
65
  containerStyle={{marginVertical: 20}}
67
66
  label={'Date'}
68
67
  placeholder={'Select a date'}
@@ -72,7 +71,6 @@ export default class DateTimePickerScreen extends Component<{}, State> {
72
71
  // value={new Date('October 13, 2014')}
73
72
  />
74
73
  <DateTimePicker
75
- migrateDialog
76
74
  mode={'time'}
77
75
  label={'Time'}
78
76
  placeholder={'Select time'}
@@ -83,14 +81,12 @@ export default class DateTimePickerScreen extends Component<{}, State> {
83
81
  Disabled
84
82
  </Text>
85
83
  <DateTimePicker
86
- migrateDialog
87
84
  containerStyle={{marginBottom: 20}}
88
85
  editable={false}
89
86
  label={'Date'}
90
87
  placeholder={'Select a date'}
91
88
  />
92
89
  <DateTimePicker
93
- migrateDialog
94
90
  editable={false}
95
91
  mode={'time'}
96
92
  label={'Time'}
@@ -111,7 +107,6 @@ export default class DateTimePickerScreen extends Component<{}, State> {
111
107
  </View>
112
108
  </View>
113
109
  <DateTimePicker
114
- migrateDialog
115
110
  containerStyle={{marginVertical: 20}}
116
111
  renderInput={this.renderCustomInput}
117
112
  mode={mode}
@@ -1,7 +1,7 @@
1
1
  import React, {Component} from 'react';
2
2
  import {StyleSheet} from 'react-native';
3
3
  import {FlatList} from 'react-native-gesture-handler';
4
- import {View, Text, Card, Button, Incubator, Colors, Spacings, ModalProps} from 'react-native-ui-lib';
4
+ import {View, Text, Card, Button, Dialog, DialogHeaderProps, Colors, Spacings, ModalProps} from 'react-native-ui-lib';
5
5
 
6
6
  interface Item {
7
7
  value: string;
@@ -31,10 +31,10 @@ const colors: Item[] = [
31
31
  {value: Colors.yellow70, label: 'Yellow70'}
32
32
  ];
33
33
 
34
- export default class IncubatorDialogScreen extends Component {
34
+ export default class DialogScreen extends Component {
35
35
  state = {visible: false};
36
36
  modalProps: ModalProps = {supportedOrientations: ['portrait', 'landscape']};
37
- headerProps: Incubator.DialogHeaderProps = {title: 'Title (swipe here)'};
37
+ headerProps: DialogHeaderProps = {title: 'Title (swipe here)'};
38
38
 
39
39
  renderVerticalItem = ({item}: {item: Item}) => {
40
40
  return (
@@ -67,13 +67,13 @@ export default class IncubatorDialogScreen extends Component {
67
67
  <View bg-$backgroundNeutralLight flex padding-20>
68
68
  <Card height={100} center padding-20>
69
69
  <Text $textDefault text50>
70
- IncubatorDialogScreen
70
+ DialogScreen
71
71
  </Text>
72
72
  </Card>
73
73
  <View flex center>
74
74
  <Button marginV-s5 label="Open Dialog" onPress={this.openDialog}/>
75
75
  </View>
76
- <Incubator.Dialog
76
+ <Dialog
77
77
  useSafeArea
78
78
  visible={visible}
79
79
  onDismiss={this.onDismiss}
@@ -89,7 +89,7 @@ export default class IncubatorDialogScreen extends Component {
89
89
  renderItem={this.renderVerticalItem}
90
90
  keyExtractor={this.keyExtractor}
91
91
  />
92
- </Incubator.Dialog>
92
+ </Dialog>
93
93
  </View>
94
94
  );
95
95
  }
@@ -6,7 +6,7 @@ import {
6
6
  View,
7
7
  Text,
8
8
  Colors,
9
- Incubator,
9
+ PanView,
10
10
  Card,
11
11
  Constants,
12
12
  Modal,
@@ -14,7 +14,6 @@ import {
14
14
  Icon,
15
15
  TouchableOpacity
16
16
  } from 'react-native-ui-lib';
17
- const {PanView} = Incubator;
18
17
 
19
18
  interface Item {
20
19
  value: string;
@@ -5,14 +5,13 @@ import {
5
5
  Assets,
6
6
  Colors,
7
7
  Typography,
8
- Incubator,
8
+ Dialog,
9
9
  View,
10
10
  Text,
11
11
  Button,
12
12
  Icon,
13
13
  Avatar,
14
14
  Picker,
15
- PanningProvider,
16
15
  PickerProps,
17
16
  RenderCustomModalProps,
18
17
  PickerMethods,
@@ -130,7 +129,7 @@ export default class PickerScreen extends Component {
130
129
  renderDialog: PickerProps['renderOverlay'] = (modalProps: RenderCustomModalProps) => {
131
130
  const {visible, children, toggleModal, onDone} = modalProps;
132
131
  return (
133
- <Incubator.Dialog
132
+ <Dialog
134
133
  visible={visible}
135
134
  onDismiss={() => {
136
135
  onDone();
@@ -141,11 +140,11 @@ export default class PickerScreen extends Component {
141
140
  bottom
142
141
  useSafeArea
143
142
  containerStyle={{backgroundColor: Colors.$backgroundDefault}}
144
- direction={PanningProvider.Directions.DOWN}
143
+ direction={Dialog.directions.DOWN}
145
144
  headerProps={{title: 'Custom modal'}}
146
145
  >
147
146
  <ScrollView>{children}</ScrollView>
148
- </Incubator.Dialog>
147
+ </Dialog>
149
148
  );
150
149
  };
151
150
 
@@ -1,6 +1,6 @@
1
1
  import _ from 'lodash';
2
2
  import React, {useCallback, useState} from 'react';
3
- import {View, Text, Incubator, WheelPicker, WheelPickerAlign, Colors, Typography, Button} from 'react-native-ui-lib';
3
+ import {View, Text, Dialog, WheelPicker, WheelPickerAlign, Colors, Typography, Button} from 'react-native-ui-lib';
4
4
 
5
5
  const monthItems = _.map([
6
6
  'January',
@@ -88,7 +88,7 @@ export default () => {
88
88
  <View center marginT-40>
89
89
  <Text h3 marginB-20>Days</Text>
90
90
  <Button size={Button.sizes.small} label={'Pick Days'} onPress={onPickDaysPress}/>
91
- <Incubator.Dialog
91
+ <Dialog
92
92
  width={'90%'}
93
93
  bottom
94
94
  visible={showDialog}
@@ -96,7 +96,7 @@ export default () => {
96
96
  headerProps={{showKnob: false, showDivider: false}}
97
97
  >
98
98
  <WheelPicker initialValue={5} label={'Days'} items={dayItems}/>
99
- </Incubator.Dialog>
99
+ </Dialog>
100
100
  </View>
101
101
  </View>
102
102
  );
@@ -32,10 +32,8 @@ export function registerScreens(registrar) {
32
32
  registrar('unicorn.components.MarqueeScreen', () => require('./MarqueeScreen').default);
33
33
  registrar('unicorn.components.NumberInputScreen', () => require('./NumberInputScreen').default);
34
34
  registrar('unicorn.components.OverlaysScreen', () => require('./OverlaysScreen').default);
35
+ registrar('unicorn.components.PanViewScreen', () => require('./PanViewScreen').default);
35
36
  registrar('unicorn.components.PageControlScreen', () => require('./PageControlScreen').default);
36
- registrar('unicorn.components.PanDismissibleScreen', () => require('./PanDismissibleScreen').default);
37
- registrar('unicorn.components.PanListenerScreen', () => require('./PanListenerScreen').default);
38
- registrar('unicorn.components.PanResponderScreen', () => require('./PanResponderScreen').default);
39
37
  registrar('unicorn.components.PickerScreen', () => require('./PickerScreen').default);
40
38
  registrar('unicorn.animations.ProgressBarScreen', () => require('../componentScreens/ProgressBarScreen').default);
41
39
  registrar('unicorn.components.ProgressiveImageScreen', () => require('./ProgressiveImageScreen').default);
@@ -44,7 +42,6 @@ export function registerScreens(registrar) {
44
42
  registrar('unicorn.components.SectionsWheelPickerScreen', () => require('./SectionsWheelPickerScreen').default);
45
43
  registrar('unicorn.components.SearchInputScreen', () => require('./SearchInputScreen').default);
46
44
  registrar('unicorn.components.SegmentedControlScreen', () => require('./SegmentedControlScreen').default);
47
- registrar('unicorn.components.SharedTransitionScreen', () => require('./SharedTransitionScreen').default);
48
45
  registrar('unicorn.components.SkeletonViewScreen', () => require('./SkeletonViewScreen').default);
49
46
  registrar('unicorn.components.SliderScreen', () => require('./SliderScreen').default);
50
47
  registrar('unicorn.components.SortableGridListScreen', () => require('./SortableGridListScreen').default);
@@ -112,7 +112,6 @@ 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
116
115
  >
117
116
  {this.renderColorRow(selectedColor)}
118
117
  </Incubator.ExpandableOverlay>
@@ -1,9 +1,7 @@
1
1
  export function registerScreens(registrar) {
2
2
  registrar('unicorn.components.IncubatorCalendarScreen', () => require('./IncubatorCalendarScreen').default);
3
3
  registrar('unicorn.incubator.TouchableOpacityScreen', () => require('./TouchableOpacityScreen').default);
4
- registrar('unicorn.incubator.IncubatorDialogScreen', () => require('./IncubatorDialogScreen').default);
5
4
  registrar('unicorn.components.IncubatorExpandableOverlayScreen', () => require('./IncubatorExpandableOverlayScreen').default);
6
5
  registrar('unicorn.components.IncubatorToastScreen', () => require('./IncubatorToastScreen').default);
7
- registrar('unicorn.incubator.PanViewScreen', () => require('./PanViewScreen').default);
8
6
  registrar('unicorn.components.IncubatorSliderScreen', () => require('./IncubatorSliderScreen').default);
9
7
  }
@@ -1,343 +0,0 @@
1
- import React, {Component} from 'react';
2
- import {FlatList, ScrollView, StyleSheet, Alert} from 'react-native';
3
- import {
4
- Text,
5
- View,
6
- Button,
7
- Dialog,
8
- Colors,
9
- PanningProvider,
10
- RadioGroup,
11
- RadioButton,
12
- Switch,
13
- Constants
14
- } from 'react-native-ui-lib'; // eslint-disable-line
15
-
16
- export default class DialogScreen extends Component {
17
- constructor(props) {
18
- super(props);
19
-
20
- this.SCROLL_TYPE = {
21
- NONE: 'none',
22
- VERTICAL: 'vertical',
23
- HORIZONTAL: 'horizontal'
24
- };
25
-
26
- this.pannableTitle = {title: 'This is a pannable header Dialog'};
27
- this.title = 'This is a Dialog';
28
- this.supportedOrientations = ['portrait', 'landscape'];
29
- this.colors = [
30
- {value: Colors.red10, label: 'Red10'},
31
- {value: Colors.red30, label: 'Red30'},
32
- {value: Colors.red50, label: 'Red50'},
33
- {value: Colors.red70, label: 'Red70'},
34
- {value: Colors.blue10, label: 'Blue10'},
35
- {value: Colors.blue30, label: 'Blue30'},
36
- {value: Colors.blue50, label: 'Blue50'},
37
- {value: Colors.blue70, label: 'Blue70'},
38
- {value: Colors.purple10, label: 'Purple10'},
39
- {value: Colors.purple30, label: 'Purple30'},
40
- {value: Colors.purple50, label: 'Purple50'},
41
- {value: Colors.purple70, label: 'Purple70'},
42
- {value: Colors.green10, label: 'Green10'},
43
- {value: Colors.green30, label: 'Green30'},
44
- {value: Colors.green50, label: 'Green50'},
45
- {value: Colors.green70, label: 'Green70'},
46
- {value: Colors.yellow10, label: 'Yellow10'},
47
- {value: Colors.yellow30, label: 'Yellow30'},
48
- {value: Colors.yellow50, label: 'Yellow50'},
49
- {value: Colors.yellow70, label: 'Yellow70'}
50
- ];
51
-
52
- this.state = {
53
- panDirection: Dialog.directions.DOWN,
54
- position: 'bottom',
55
- scroll: this.SCROLL_TYPE.NONE,
56
- showHeader: true,
57
- isRounded: true,
58
- showDialog: false,
59
- ignoreBackgroundPress: false
60
- };
61
- }
62
-
63
- titlePressed = ({title}) => {
64
- Alert.alert('Pressed on', title);
65
- };
66
-
67
- setPanDirection = panDirection => {
68
- if (panDirection !== this.state.panDirection) {
69
- this.setState({panDirection});
70
- }
71
- };
72
-
73
- setPosition = position => {
74
- if (position !== this.state.position) {
75
- this.setState({position});
76
- }
77
- };
78
-
79
- setScroll = scroll => {
80
- if (scroll !== this.state.scroll) {
81
- this.setState({scroll});
82
- }
83
- };
84
-
85
- toggleShowHeader = () => {
86
- this.setState({
87
- showHeader: !this.state.showHeader
88
- });
89
- };
90
-
91
- toggleIsRounded = () => {
92
- this.setState({
93
- isRounded: !this.state.isRounded
94
- });
95
- };
96
-
97
- toggleIgnoreBackgroundPress = () => {
98
- this.setState({
99
- ignoreBackgroundPress: !this.state.ignoreBackgroundPress
100
- });
101
- };
102
-
103
- showDialog = () => {
104
- this.setState({showDialog: true});
105
- };
106
-
107
- hideDialog = () => {
108
- this.setState({showDialog: false});
109
- };
110
-
111
- getWarning = () => {
112
- const {showHeader, scroll, panDirection} = this.state;
113
- if (!showHeader && scroll !== this.SCROLL_TYPE.NONE) {
114
- return (
115
- <Text color={Colors.$textDangerLight}>It is recommended to have pannable header with scrollable content</Text>
116
- );
117
- } else if (showHeader && panDirection !== Dialog.directions.DOWN) {
118
- return <Text color={Colors.$textDangerLight}>It is recommended to have pannable header with direction=down</Text>;
119
- }
120
- };
121
-
122
- getMessage = () => {
123
- const {panDirection, position, scroll} = this.state;
124
-
125
- return `Panning direction: ${panDirection ? panDirection : 'none'}
126
- Position: ${position ? position : 'center'}
127
- Scroll: ${scroll}`;
128
- };
129
-
130
- renderPannableHeader = props => {
131
- const {title} = props;
132
- return (
133
- <View>
134
- <View margin-20>
135
- <Text $textDefault>{title}</Text>
136
- </View>
137
- <View height={2} bg-grey70/>
138
- </View>
139
- );
140
- };
141
-
142
- renderPlainContent = () => {
143
- return (
144
- <View margin-20 right>
145
- <Button text60 label="Done" link onPress={this.hideDialog}/>
146
- </View>
147
- );
148
- };
149
-
150
- keyExtractor = item => {
151
- return item.value;
152
- };
153
-
154
- renderVerticalItem = ({item: color}) => {
155
- return (
156
- <Text $textDefault text50 margin-20 color={color.value}>
157
- {color.label}
158
- </Text>
159
- );
160
- };
161
-
162
- renderVerticalScroll = () => {
163
- return (
164
- <FlatList
165
- showsVerticalScrollIndicator={false}
166
- style={styles.verticalScroll}
167
- data={this.colors}
168
- renderItem={this.renderVerticalItem}
169
- keyExtractor={this.keyExtractor}
170
- />
171
- );
172
- };
173
-
174
- renderHorizontalItem = ({item: color}) => {
175
- return <View flex width={100} height={1000} style={{backgroundColor: color.value}}/>;
176
- };
177
-
178
- renderHorizontalScroll = () => {
179
- return (
180
- <View marginT-20 pointerEvents="box-none">
181
- <FlatList
182
- horizontal
183
- showsHorizontalScrollIndicator={false}
184
- data={this.colors}
185
- renderItem={this.renderHorizontalItem}
186
- keyExtractor={this.keyExtractor}
187
- />
188
- <View row pointerEvents="none" style={styles.horizontalTextContainer}>
189
- <Text>
190
- {'\u25c0'} Scroll me {'\u25b6'}
191
- </Text>
192
- </View>
193
- </View>
194
- );
195
- };
196
-
197
- renderContent = () => {
198
- const {scroll, showHeader} = this.state;
199
-
200
- let content;
201
- switch (scroll) {
202
- case this.SCROLL_TYPE.VERTICAL:
203
- content = this.renderVerticalScroll();
204
- break;
205
- case this.SCROLL_TYPE.HORIZONTAL:
206
- content = this.renderHorizontalScroll();
207
- break;
208
- case this.SCROLL_TYPE.NONE:
209
- default:
210
- content = this.renderPlainContent();
211
- break;
212
- }
213
-
214
- const data = (
215
- <View spread flex={scroll !== this.SCROLL_TYPE.NONE}>
216
- <View marginT-20 marginH-20>
217
- {!showHeader && <Text $textDefault text50>{this.title}</Text>}
218
- <Text $textDefault marginT-20={!showHeader}>{this.getMessage()}</Text>
219
- {this.getWarning()}
220
- </View>
221
- {content}
222
- </View>
223
- );
224
-
225
- return data;
226
- };
227
-
228
- getDialogKey = height => {
229
- const {position} = this.state;
230
- return `dialog-key-${position}-${height}`;
231
- };
232
-
233
- renderDialog = () => {
234
- const {showDialog, panDirection, position, scroll, showHeader, isRounded, ignoreBackgroundPress} = this.state;
235
- const renderPannableHeader = showHeader ? this.renderPannableHeader : undefined;
236
- const height = scroll !== this.SCROLL_TYPE.NONE ? '70%' : undefined;
237
-
238
- return (
239
- <Dialog
240
- useSafeArea
241
- key={this.getDialogKey(height)}
242
- top={position === 'top'}
243
- bottom={position === 'bottom'}
244
- height={height}
245
- panDirection={panDirection}
246
- containerStyle={isRounded ? styles.roundedDialog : styles.dialog}
247
- visible={showDialog}
248
- onDismiss={this.hideDialog}
249
- renderPannableHeader={renderPannableHeader}
250
- pannableHeaderProps={this.pannableTitle}
251
- supportedOrientations={this.supportedOrientations}
252
- ignoreBackgroundPress={ignoreBackgroundPress}
253
- >
254
- {this.renderContent()}
255
- </Dialog>
256
- );
257
- };
258
-
259
- render() {
260
- const {panDirection, position, scroll, showHeader, isRounded, ignoreBackgroundPress} = this.state;
261
-
262
- return (
263
- <ScrollView>
264
- <View flex padding-12>
265
- <Text $textDefault text30 marginB-20>
266
- Dialog
267
- </Text>
268
-
269
- <RadioGroup marginT-20 initialValue={panDirection} onValueChange={this.setPanDirection}>
270
- <Text $textDefault>Panning Direction:</Text>
271
- <View row marginV-10>
272
- <RadioButton value={null} label={'None'}/>
273
- <RadioButton value={Dialog.directions.UP} label={'Up'} marginL-10/>
274
- <RadioButton value={Dialog.directions.DOWN} label={'Down'} marginL-10/>
275
- <RadioButton value={Dialog.directions.LEFT} label={'Left'} marginL-10/>
276
- <RadioButton value={Dialog.directions.RIGHT} label={'Right'} marginL-10/>
277
- </View>
278
- </RadioGroup>
279
-
280
- <RadioGroup marginT-20 initialValue={position} onValueChange={this.setPosition}>
281
- <Text $textDefault>Position:</Text>
282
- <View row marginV-10>
283
- <RadioButton value={'top'} label={'Top'}/>
284
- <RadioButton value={null} label={'Center'} marginL-10/>
285
- <RadioButton value={'bottom'} label={'Bottom'} marginL-10/>
286
- </View>
287
- </RadioGroup>
288
-
289
- <RadioGroup marginT-20 initialValue={scroll} onValueChange={this.setScroll}>
290
- <Text $textDefault>Scroll:</Text>
291
- <View row marginV-10>
292
- <RadioButton value={this.SCROLL_TYPE.NONE} label={'None'}/>
293
- <RadioButton value={this.SCROLL_TYPE.VERTICAL} label={'Vertical'} marginL-10/>
294
- <RadioButton value={this.SCROLL_TYPE.HORIZONTAL} label={'Horizontal'} marginL-10/>
295
- </View>
296
- </RadioGroup>
297
-
298
- <View row marginT-20 centerV>
299
- <Text $textDefault>Toggle pannable header:</Text>
300
- <Switch value={showHeader} onValueChange={this.toggleShowHeader} marginL-10/>
301
- </View>
302
-
303
- <View row marginT-20 centerV>
304
- <Text $textDefault>Add some style:</Text>
305
- <Switch value={isRounded} onValueChange={this.toggleIsRounded} marginL-10/>
306
- </View>
307
-
308
- <View row marginT-20 centerV>
309
- <Text $textDefault>Ignore Background Press:</Text>
310
- <Switch value={ignoreBackgroundPress} onValueChange={this.toggleIgnoreBackgroundPress} marginL-10/>
311
- </View>
312
-
313
- <Button marginT-50 label={'Show dialog'} onPress={this.showDialog}/>
314
-
315
- {this.renderDialog()}
316
- </View>
317
- </ScrollView>
318
- );
319
- }
320
- }
321
-
322
- const styles = StyleSheet.create({
323
- dialog: {
324
- backgroundColor: Colors.$backgroundDefault
325
- },
326
- roundedDialog: {
327
- backgroundColor: Colors.$backgroundDefault,
328
- marginBottom: Constants.isIphoneX ? 0 : 20,
329
- borderRadius: 12
330
- },
331
- button: {
332
- margin: 5,
333
- alignSelf: 'flex-start'
334
- },
335
- verticalScroll: {
336
- marginTop: 20
337
- },
338
- horizontalTextContainer: {
339
- alignSelf: 'center',
340
- position: 'absolute',
341
- top: 10
342
- }
343
- });
@@ -1,112 +0,0 @@
1
- import React, {Component} from 'react';
2
- import {StyleSheet} from 'react-native';
3
- import {
4
- Button,
5
- View,
6
- Text,
7
- Switch,
8
- Colors,
9
- Typography,
10
- PanListenerView,
11
- PanningProvider,
12
- PanDismissibleView
13
- } from 'react-native-ui-lib';
14
-
15
- const PAN_LISTENER_VIEW_HEIGHT = 100;
16
-
17
- export default class PanDismissibleScreen extends Component {
18
- state = {
19
- location: {left: 50, top: 50},
20
- isCoupled: true,
21
- key: false
22
- };
23
-
24
- switchExample = () => {
25
- const {isCoupled, location} = this.state;
26
- if (isCoupled) {
27
- this.setState({
28
- isCoupled: false,
29
- location: {left: location.left, top: location.top - PAN_LISTENER_VIEW_HEIGHT}
30
- });
31
- } else {
32
- this.setState({
33
- isCoupled: true,
34
- location: {left: location.left, top: location.top + PAN_LISTENER_VIEW_HEIGHT}
35
- });
36
- }
37
- };
38
-
39
- reset = () => {
40
- this.setState({key: !this.state.key});
41
- };
42
-
43
- renderPanListener = () => {
44
- return (
45
- <PanListenerView style={styles.panListener}>
46
- <Text style={styles.largeText}>Drag\Swipe here</Text>
47
- </PanListenerView>
48
- );
49
- };
50
-
51
- render() {
52
- const {isCoupled, key} = this.state;
53
- const panListener = this.renderPanListener();
54
-
55
- return (
56
- <View flex bg-grey80>
57
- <Text style={styles.largeText}>Pan Dismissible</Text>
58
- <View style={styles.container}>
59
- <Switch value={isCoupled} onValueChange={this.switchExample} style={styles.switch}/>
60
- <Text style={styles.smallText}>{isCoupled ? 'Coupled' : 'Uncoupled'}</Text>
61
- </View>
62
- <Button label="Reset" size={Button.sizes.medium} outline style={styles.button} onPress={this.reset}/>
63
- <View centerH>
64
- <PanningProvider>
65
- {!isCoupled && panListener}
66
- <PanDismissibleView
67
- key={key.toString()}
68
- style={[styles.panDismissible, {marginTop: isCoupled ? PAN_LISTENER_VIEW_HEIGHT : undefined}]}
69
- >
70
- {isCoupled && panListener}
71
- </PanDismissibleView>
72
- </PanningProvider>
73
- </View>
74
- </View>
75
- );
76
- }
77
- }
78
-
79
- const styles = StyleSheet.create({
80
- largeText: {
81
- ...Typography.text50,
82
- margin: 20
83
- },
84
- container: {
85
- flexDirection: 'row',
86
- marginBottom: 20,
87
- alignSelf: 'center'
88
- },
89
- panDismissible: {
90
- width: 250,
91
- height: 250,
92
- backgroundColor: Colors.blue30
93
- },
94
- panListener: {
95
- width: '100%',
96
- height: PAN_LISTENER_VIEW_HEIGHT,
97
- backgroundColor: Colors.blue60,
98
- justifyContent: 'center'
99
- },
100
- smallText: {
101
- ...Typography.text70,
102
- marginLeft: 20
103
- },
104
- switch: {
105
- marginLeft: 20,
106
- alignSelf: 'center'
107
- },
108
- button: {
109
- alignSelf: 'center',
110
- marginBottom: 20
111
- }
112
- });
@@ -1,63 +0,0 @@
1
- import React, {Component} from 'react';
2
- import {View, Text, PanListenerView, PanDirectionsProps, PanAmountsProps} from 'react-native-ui-lib';
3
-
4
- export default class PanListenerScreen extends Component {
5
- state = {
6
- locationText: '',
7
- endType: ''
8
- };
9
-
10
- onDrag = ({directions}: ({directions: PanDirectionsProps, deltas: PanAmountsProps})) => {
11
- this.setState({locationText: `Dragged: ${directions.x}, ${directions.y}`});
12
- };
13
-
14
- onSwipe = ({directions}: ({directions: PanDirectionsProps, velocities: PanAmountsProps})) => {
15
- this.setState({locationText: `Swiped: ${directions.x}, ${directions.y}`});
16
- };
17
-
18
- onPanStart = () => {
19
- this.setState({endType: 'Panning'});
20
- };
21
-
22
- onPanRelease = () => {
23
- this.setState({endType: 'Released'});
24
- };
25
-
26
- onPanTerminated = () => {
27
- this.setState({endType: 'Terminated'});
28
- };
29
-
30
- render() {
31
- const {locationText, endType} = this.state;
32
-
33
- return (
34
- <View flex bg-grey80>
35
- <Text text50 margin-40>
36
- Pan Listener
37
- </Text>
38
- <PanListenerView
39
- bg-grey70
40
- centerV
41
- height={300}
42
- width="100%"
43
- // directions={[PanningProvider.Directions.UP, PanningProvider.Directions.DOWN]}
44
- onDrag={this.onDrag}
45
- onSwipe={this.onSwipe}
46
- onPanStart={this.onPanStart}
47
- onPanRelease={this.onPanRelease}
48
- onPanTerminated={this.onPanTerminated}
49
- >
50
- <Text text50 margin-40>
51
- Drag\swipe here
52
- </Text>
53
- </PanListenerView>
54
- <Text text50 margin-40>
55
- {locationText}
56
- </Text>
57
- <Text text50 margin-40>
58
- {endType}
59
- </Text>
60
- </View>
61
- );
62
- }
63
- }
@@ -1,99 +0,0 @@
1
- import _ from 'lodash';
2
- import React, {Component} from 'react';
3
- import {StyleSheet} from 'react-native';
4
- import {
5
- View,
6
- Text,
7
- Switch,
8
- Colors,
9
- Typography,
10
- PanListenerView,
11
- PanningProvider,
12
- PanResponderView
13
- } from 'react-native-ui-lib';
14
-
15
- const PAN_LISTENER_VIEW_HEIGHT = 100;
16
-
17
- export default class PanResponderScreen extends Component {
18
- state = {
19
- location: {left: 50, top: 50},
20
- isCoupled: false
21
- };
22
-
23
- switchExample = () => {
24
- const {isCoupled, location} = this.state;
25
- if (isCoupled) {
26
- this.setState({
27
- isCoupled: false,
28
- location: {left: location.left, top: location.top - PAN_LISTENER_VIEW_HEIGHT}
29
- });
30
- } else {
31
- this.setState({
32
- isCoupled: true,
33
- location: {left: location.left, top: location.top + PAN_LISTENER_VIEW_HEIGHT}
34
- });
35
- }
36
- };
37
-
38
- renderPanListener = () => {
39
- return (
40
- <PanListenerView style={styles.panListener}>
41
- <Text style={styles.largeText}>Drag here</Text>
42
- </PanListenerView>
43
- );
44
- };
45
-
46
- render() {
47
- const {isCoupled} = this.state;
48
- const panListener = this.renderPanListener();
49
-
50
- return (
51
- <View flex bg-grey80>
52
- <View style={styles.container}>
53
- <Text style={styles.largeText}>Pan Responder</Text>
54
- <Switch value={isCoupled} onValueChange={this.switchExample} style={styles.switch} />
55
- <Text style={styles.smallText}>{isCoupled ? 'Coupled' : 'Uncoupled'}</Text>
56
- </View>
57
- <PanningProvider>
58
- {!isCoupled && panListener}
59
- <PanResponderView
60
- style={[styles.panResponder, {marginTop: isCoupled ? PAN_LISTENER_VIEW_HEIGHT : undefined}]}
61
- >
62
- {isCoupled && panListener}
63
- </PanResponderView>
64
- </PanningProvider>
65
- </View>
66
- );
67
- }
68
- }
69
-
70
- const styles = StyleSheet.create({
71
- container: {
72
- flexDirection: 'row',
73
- height: 50,
74
- alignItems: 'center'
75
- },
76
- panResponder: {
77
- width: 250,
78
- height: 250,
79
- backgroundColor: Colors.blue30
80
- },
81
- panListener: {
82
- width: '100%',
83
- height: PAN_LISTENER_VIEW_HEIGHT,
84
- backgroundColor: Colors.blue60,
85
- justifyContent: 'center'
86
- },
87
- largeText: {
88
- ...Typography.text50,
89
- marginLeft: 40
90
- },
91
- smallText: {
92
- ...Typography.text70,
93
- marginLeft: 20
94
- },
95
- switch: {
96
- marginLeft: 20,
97
- alignSelf: 'center'
98
- }
99
- });
@@ -1,143 +0,0 @@
1
- import React, {Component} from 'react';
2
- import {LayoutAnimation, FlatList} from 'react-native';
3
- import {Colors, View, Image, TouchableOpacity, SharedTransition, Card, Button, Text, Modal} from 'react-native-ui-lib'; //eslint-disable-line
4
-
5
- const DATA = [
6
- {
7
- id: '12',
8
- title: 'white pendant lamp',
9
- location: 'Paris, France',
10
- views: 1224,
11
- image:
12
- 'https://images.unsplash.com/photo-1513506003901-1e6a229e2d15?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1500&q=80',
13
- },
14
- {
15
- id: '13',
16
- title: 'black floor lamp at the corner',
17
- location: 'Paris, France',
18
- views: 302,
19
- image:
20
- 'https://images.unsplash.com/photo-1494438639946-1ebd1d20bf85?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1494&q=80',
21
- },
22
- {
23
- id: '14',
24
- title: 'gray desk lamp near white wall',
25
- location: 'Paris, France',
26
- views: 554,
27
- image:
28
- 'https://images.unsplash.com/photo-1507473885765-e6ed057f782c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=668&q=80',
29
- },
30
- {
31
- id: '15',
32
- title: 'round white and yellow bowl illustration',
33
- location: 'Paris, France',
34
- views: 1999,
35
- image:
36
- 'https://images.unsplash.com/photo-1526308430620-59f514ed2152?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1500&q=80',
37
- },
38
- {
39
- id: '16',
40
- title: 'black and orange polka dot print textile',
41
- location: 'Paris, France',
42
- views: 2014,
43
- image:
44
- 'https://images.unsplash.com/photo-1544070643-24128d1f6033?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=668&q=80',
45
- },
46
- ];
47
-
48
- export default class SharedTransitionScreen extends Component {
49
- constructor(props) {
50
- super(props);
51
-
52
- this.cards = [];
53
- }
54
-
55
- state = {
56
- showDetails: false,
57
- };
58
-
59
- renderItem = ({item}) => {
60
- return (
61
- <View marginB-20 padding-20 row height={280}>
62
- <Card padding-20 marginV-20 width={'60%'} style={{zIndex: 10}} spread>
63
- <View>
64
- <Text text70 grey10>
65
- {item.title}
66
- </Text>
67
- <Text text80 grey30>
68
- {item.location}
69
- </Text>
70
- </View>
71
- <View>
72
- <Text text70 grey30>
73
- <Text text50 purple30>
74
- {item.views}
75
- </Text>
76
- {' Views'}
77
- </Text>
78
- </View>
79
- </Card>
80
- <SharedTransition.Source
81
- id={item.id}
82
- data={item}
83
- style={[
84
- {overflow: 'hidden', position: 'absolute', right: 20, top: 20, bottom: 20, width: '45%', height: 200},
85
- ]}
86
- >
87
- {this.renderSharedElement(item)}
88
- </SharedTransition.Source>
89
- </View>
90
- );
91
- };
92
-
93
- renderList() {
94
- return <FlatList data={DATA} renderItem={this.renderItem} keyExtractor={item => item.title} />;
95
- }
96
-
97
- renderSharedElement(item = {}) {
98
- return (
99
- <View flex>
100
- <Image
101
- style={{width: '100%', height: '100%', borderRadius: 10}}
102
- source={{
103
- uri: item.image,
104
- }}
105
- />
106
- </View>
107
- );
108
- }
109
-
110
- renderDetails = (data = {}) => {
111
- return (
112
- <View flex pointerEvents="box-none" padding-20 paddingT-50>
113
- <View row>
114
- <SharedTransition.Target style={{width: 200, height: 280, marginLeft: -30}}>
115
- {data && this.renderSharedElement(data, true)}
116
- </SharedTransition.Target>
117
- <View flex paddingL-20>
118
- <Text text50>{data.title}</Text>
119
- <Text text90 purple30 marginT-10>
120
- {data.views} Views
121
- </Text>
122
- </View>
123
- </View>
124
- <View left marginT-20>
125
- <Text text60>{data.location}</Text>
126
- <Text>
127
- when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived
128
- not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged
129
- </Text>
130
- <Button link marginT-20 grey10 label="Learn More" size="small" />
131
- </View>
132
- </View>
133
- );
134
- };
135
-
136
- render() {
137
- return (
138
- <View flex grey80>
139
- <SharedTransition.Area renderDetails={this.renderDetails}>{this.renderList()}</SharedTransition.Area>
140
- </View>
141
- );
142
- }
143
- }