unicorn-demo-app 6.3.0 → 6.3.1

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.3.0",
3
+ "version": "6.3.1",
4
4
  "main": "src/index.js",
5
5
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
6
6
  "license": "MIT",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "scripts": {
15
15
  "release": "node ./scripts/release.js",
16
- "jenkinsRelease": "node ./scripts/jenkinsRelease.js"
16
+ "demoRelease": "node ./scripts/demoRelease.js"
17
17
  },
18
18
  "devDependencies": {
19
19
  "react-native-ui-lib": "*",
@@ -2,12 +2,16 @@ const exec = require('shell-utils').exec;
2
2
  const semver = require('semver');
3
3
  const _ = require('lodash');
4
4
  const p = require('path');
5
+ const cp = require('child_process');
5
6
 
6
7
  // Workaround JS
7
- const isRelease = process.env.RELEASE_BUILD === 'true';
8
- const branch = process.env.BRANCH;
9
8
 
10
- const ONLY_ON_BRANCH = `origin/${branch || 'master'}`;
9
+ const isRelease = process.env.BUILDKITE_MESSAGE.match(/^release$/i);
10
+ let VERSION;
11
+ if (isRelease) {
12
+ VERSION = cp.execSync(`buildkite-agent meta-data get version`).toString();
13
+ }
14
+
11
15
  const VERSION_TAG = isRelease ? 'latest' : 'snapshot';
12
16
  const VERSION_INC = 'patch';
13
17
 
@@ -15,38 +19,17 @@ function run() {
15
19
  if (!validateEnv()) {
16
20
  return;
17
21
  }
18
- setupGit();
19
22
  createNpmRc();
20
23
  versionTagAndPublish();
21
24
  }
22
25
 
23
26
  function validateEnv() {
24
- if (!process.env.JENKINS_CI) {
27
+ if (!process.env.CI) {
25
28
  throw new Error('releasing is only available from CI');
26
29
  }
27
-
28
- if (!process.env.JENKINS_MASTER) {
29
- console.log('not publishing on a different build');
30
- return false;
31
- }
32
-
33
- if (process.env.GIT_BRANCH !== ONLY_ON_BRANCH) {
34
- console.log(`not publishing on branch ${process.env.GIT_BRANCH}`);
35
- return false;
36
- }
37
-
38
30
  return true;
39
31
  }
40
32
 
41
- function setupGit() {
42
- exec.execSyncSilent('git config --global push.default simple');
43
- exec.execSyncSilent(`git config --global user.email "${process.env.GIT_EMAIL}"`);
44
- exec.execSyncSilent(`git config --global user.name "${process.env.GIT_USER}"`);
45
- const remoteUrl = new RegExp('https?://(\\S+)').exec(exec.execSyncRead('git remote -v'))[1];
46
- exec.execSyncSilent(`git remote add deploy "https://${process.env.GIT_USER}:${process.env.GIT_TOKEN}@${remoteUrl}"`);
47
- // exec.execSync(`git checkout ${ONLY_ON_BRANCH}`);
48
- }
49
-
50
33
  function createNpmRc() {
51
34
  exec.execSync('rm -f package-lock.json');
52
35
  const npmrcPath = p.resolve(`${__dirname}/.npmrc`);
@@ -57,7 +40,7 @@ function versionTagAndPublish() {
57
40
  const currentPublished = findCurrentPublishedVersion();
58
41
  console.log(`current published version: ${currentPublished}`);
59
42
 
60
- const version = isRelease ? process.env.VERSION : `${currentPublished}-snapshot.${process.env.BUILD_ID}`;
43
+ const version = isRelease ? VERSION : `${currentPublished}-snapshot.${process.env.BUILDKITE_BUILD_NUMBER}`;
61
44
  console.log(`Publishing version: ${version}`);
62
45
 
63
46
  tryPublishAndTag(version);
@@ -154,6 +154,7 @@ export const navigationData = {
154
154
  title: 'Incubator (Experimental)',
155
155
  screens: [
156
156
  {title: 'Native TouchableOpacity', tags: 'touchable native', screen: 'unicorn.incubator.TouchableOpacityScreen'},
157
+ {title: '(New) Dialog', tags: 'dialog modal popup alert', screen: 'unicorn.incubator.IncubatorDialogScreen'},
157
158
  {title: '(New) TextField', tags: 'text field input', screen: 'unicorn.components.IncubatorTextFieldScreen'},
158
159
  {title: 'ExpandableOverlay', tags: 'text field expandable input picker', screen: 'unicorn.components.IncubatorExpandableOverlayScreen'},
159
160
  {title: 'WheelPicker (Incubator)', tags: 'wheel picker spinner experimental', screen: 'unicorn.incubator.WheelPickerScreen'},
@@ -171,7 +171,7 @@ export default class PickerScreen extends Component {
171
171
  onChange={filter => this.setState({filter})}
172
172
  renderPicker={({label}) => {
173
173
  return (
174
- <View row center>
174
+ <View row>
175
175
  <Image style={{marginRight: 1, height: 16, resizeMode: 'contain'}} source={tagIcon}/>
176
176
  <Text grey10 text80>
177
177
  {label} Posts
@@ -194,7 +194,7 @@ export default class PickerScreen extends Component {
194
194
  getItemValue={contact => contact.name}
195
195
  renderPicker={contact => {
196
196
  return (
197
- <View row center>
197
+ <View row>
198
198
  <Avatar size={30} source={{uri: contact.thumbnail}}/>
199
199
  <Text text70 marginL-10>
200
200
  {contact.name}
@@ -0,0 +1,102 @@
1
+ import React, {Component} from 'react';
2
+ import {StyleSheet} from 'react-native';
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
5
+
6
+ interface Item {
7
+ value: string;
8
+ label: string;
9
+ }
10
+
11
+ const colors: Item[] = [
12
+ {value: Colors.red10, label: 'Red10'},
13
+ {value: Colors.red30, label: 'Red30'},
14
+ {value: Colors.red50, label: 'Red50'},
15
+ {value: Colors.red70, label: 'Red70'},
16
+ {value: Colors.blue10, label: 'Blue10'},
17
+ {value: Colors.blue30, label: 'Blue30'},
18
+ {value: Colors.blue50, label: 'Blue50'},
19
+ {value: Colors.blue70, label: 'Blue70'},
20
+ {value: Colors.purple10, label: 'Purple10'},
21
+ {value: Colors.purple30, label: 'Purple30'},
22
+ {value: Colors.purple50, label: 'Purple50'},
23
+ {value: Colors.purple70, label: 'Purple70'},
24
+ {value: Colors.green10, label: 'Green10'},
25
+ {value: Colors.green30, label: 'Green30'},
26
+ {value: Colors.green50, label: 'Green50'},
27
+ {value: Colors.green70, label: 'Green70'},
28
+ {value: Colors.yellow10, label: 'Yellow10'},
29
+ {value: Colors.yellow30, label: 'Yellow30'},
30
+ {value: Colors.yellow50, label: 'Yellow50'},
31
+ {value: Colors.yellow70, label: 'Yellow70'}
32
+ ];
33
+
34
+ export default class IncubatorDialogScreen extends Component {
35
+ state = {visible: false};
36
+
37
+ renderVerticalItem = ({item}: {item: Item}) => {
38
+ return (
39
+ <Text text50 margin-20 color={item.value}>
40
+ {item.label}
41
+ </Text>
42
+ );
43
+ };
44
+
45
+ keyExtractor = (item: Item) => {
46
+ return item.value;
47
+ };
48
+
49
+ openDialog = () => {
50
+ this.setState({visible: true});
51
+ };
52
+
53
+ closeDialog = () => {
54
+ this.setState({visible: false});
55
+ };
56
+
57
+ render() {
58
+ const {visible} = this.state;
59
+
60
+ return (
61
+ <View bg-dark80 flex padding-20>
62
+ <Card height={100} center padding-20>
63
+ <Text text50>IncubatorDialogScreen</Text>
64
+ </Card>
65
+ <View flex center>
66
+ <Button marginV-20 label="Open Dialog" onPress={this.openDialog}/>
67
+ </View>
68
+ <Incubator.Dialog visible={visible} onDismiss={this.closeDialog} bottom containerStyle={styles.dialogContainer}>
69
+ <View style={styles.dialog}>
70
+ <Text text60 margin-s2>
71
+ Title (swipe here)
72
+ </Text>
73
+ <View height={1} bg-grey40/>
74
+ <FlatList
75
+ showsVerticalScrollIndicator={false}
76
+ style={styles.verticalScroll}
77
+ data={colors}
78
+ renderItem={this.renderVerticalItem}
79
+ keyExtractor={this.keyExtractor}
80
+ />
81
+ </View>
82
+ </Incubator.Dialog>
83
+ </View>
84
+ );
85
+ }
86
+ }
87
+
88
+ const styles = StyleSheet.create({
89
+ dialogContainer: {
90
+ bottom: 20,
91
+ alignSelf: 'center'
92
+ },
93
+ dialog: {
94
+ backgroundColor: Colors.white,
95
+ width: 200,
96
+ height: 300,
97
+ borderRadius: BorderRadiuses.br20
98
+ },
99
+ verticalScroll: {
100
+ marginTop: 20
101
+ }
102
+ });
@@ -89,11 +89,10 @@ export default class TextFieldScreen extends Component {
89
89
  </Text>
90
90
  <Incubator.ExpandableOverlay
91
91
  ref={this.expandableInputRef}
92
- modalProps={{animationType: 'slide'}}
92
+ modalProps={{animationType: 'slide', onDismiss: () => console.warn('Modal is dismissed')}}
93
93
  expandableContent={this.renderInputModal()}
94
94
  showTopBar
95
95
  topBarProps={{title: 'Edit Input', doneLabel: 'Done', onCancel: this.onCancel, onDone: this.onDone}}
96
- dialogProps={{bottom: true}}
97
96
  >
98
97
  <Incubator.TextField placeholder="Expandable input" value={textFieldValue}/>
99
98
  </Incubator.ExpandableOverlay>
@@ -112,7 +111,7 @@ export default class TextFieldScreen extends Component {
112
111
  ref={this.expandablePickerRef}
113
112
  useDialog
114
113
  expandableContent={this.renderPickerContent()}
115
- dialogProps={{bottom: true}}
114
+ dialogProps={{bottom: true, onDismiss: () => console.warn('Dialog is dismissed')}}
116
115
  >
117
116
  {this.renderColorRow(selectedColor)}
118
117
  </Incubator.ExpandableOverlay>
@@ -5,16 +5,16 @@ const {TransitionView} = Incubator;
5
5
  import {renderRadioGroup} from '../ExampleScreenPresenter';
6
6
 
7
7
  interface State {
8
- enterDirection: Incubator.Direction;
9
- exitDirection: Incubator.Direction;
8
+ enterDirection: Incubator.TransitionViewDirection;
9
+ exitDirection: Incubator.TransitionViewDirection;
10
10
  key: number;
11
11
  }
12
12
 
13
13
  export default class TransitionViewScreen extends Component<{}, State> {
14
14
  private ref = React.createRef<typeof TransitionView>();
15
15
  state = {
16
- enterDirection: 'left' as Incubator.Direction,
17
- exitDirection: 'bottom' as Incubator.Direction,
16
+ enterDirection: Incubator.TransitionViewDirectionEnum.LEFT,
17
+ exitDirection: Incubator.TransitionViewDirectionEnum.DOWN,
18
18
  key: 1
19
19
  };
20
20
 
@@ -30,21 +30,16 @@ export default class TransitionViewScreen extends Component<{}, State> {
30
30
  const {key, enterDirection, exitDirection} = this.state;
31
31
  return (
32
32
  <View padding-20 bg-grey80 flex>
33
- {renderRadioGroup.call(this,
34
- 'Enter direction',
35
- 'enterDirection',
36
- {top: 'top', bottom: 'bottom', left: 'left', right: 'right'},
37
- {isRow: true})}
38
- {renderRadioGroup.call(this,
39
- 'Exit direction',
40
- 'exitDirection',
41
- {top: 'top', bottom: 'bottom', left: 'left', right: 'right'},
42
- {isRow: true})}
33
+ {renderRadioGroup.call(this, 'Enter direction', 'enterDirection', Incubator.TransitionViewDirectionEnum, {
34
+ isRow: true
35
+ })}
36
+ {renderRadioGroup.call(this, 'Exit direction', 'exitDirection', Incubator.TransitionViewDirectionEnum, {
37
+ isRow: true
38
+ })}
43
39
  <Button label="Refresh" onPress={() => this.setState({key: key + 1})}/>
44
40
  <View flex center>
45
41
  <TransitionView
46
42
  key={`${key}`}
47
- // @ts-expect-error
48
43
  ref={this.ref}
49
44
  enterFrom={enterDirection}
50
45
  exitTo={exitDirection}
@@ -3,6 +3,7 @@ import {gestureHandlerRootHOC} from 'react-native-gesture-handler';
3
3
  export function registerScreens(registrar) {
4
4
  registrar('unicorn.incubator.TouchableOpacityScreen', () =>
5
5
  gestureHandlerRootHOC(require('./TouchableOpacityScreen').default));
6
+ registrar('unicorn.incubator.IncubatorDialogScreen', () => require('./IncubatorDialogScreen').default);
6
7
  registrar('unicorn.components.IncubatorExpandableOverlayScreen', () => require('./IncubatorExpandableOverlayScreen').default);
7
8
  registrar('unicorn.components.IncubatorTextFieldScreen', () => require('./IncubatorTextFieldScreen').default);
8
9
  registrar('unicorn.incubator.PanViewScreen', () => require('./PanViewScreen').default);