Skip to content

Commit 00ee43b

Browse files
authored
Export loadDemoConfigurations for expo-snack app (#1575)
1 parent ad93e94 commit 00ee43b

File tree

3 files changed

+52
-48
lines changed

3 files changed

+52
-48
lines changed

demo/src/configurations.js

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,57 @@
11
import {Assets, Colors, Typography, Spacings, Incubator} from 'react-native-ui-lib'; // eslint-disable-line
22

3-
Assets.loadAssetsGroup('icons.demo', {
4-
chevronDown: require('./assets/icons/chevronDown.png'),
5-
add: require('./assets/icons/add.png'),
6-
camera: require('./assets/icons/cameraSelected.png'),
7-
close: require('./assets/icons/close.png'),
8-
dashboard: require('./assets/icons/dashboard.png'),
9-
image: require('./assets/icons/image.png'),
10-
plus: require('./assets/icons/plus.png'),
11-
refresh: require('./assets/icons/refresh.png'),
12-
search: require('./assets/icons/search.png'),
13-
share: require('./assets/icons/share.png')
14-
});
3+
export const loadDemoConfigurations = () => {
4+
Assets.loadAssetsGroup('icons.demo', {
5+
chevronDown: require('./assets/icons/chevronDown.png'),
6+
add: require('./assets/icons/add.png'),
7+
camera: require('./assets/icons/cameraSelected.png'),
8+
close: require('./assets/icons/close.png'),
9+
dashboard: require('./assets/icons/dashboard.png'),
10+
image: require('./assets/icons/image.png'),
11+
plus: require('./assets/icons/plus.png'),
12+
refresh: require('./assets/icons/refresh.png'),
13+
search: require('./assets/icons/search.png'),
14+
share: require('./assets/icons/share.png')
15+
});
1516

16-
Assets.loadAssetsGroup('images.demo', {
17-
brokenImage: require('./assets/images/placeholderMissingImage.png')
18-
});
17+
Assets.loadAssetsGroup('images.demo', {
18+
brokenImage: require('./assets/images/placeholderMissingImage.png')
19+
});
1920

20-
Assets.loadAssetsGroup('svgs.demo', {
21-
logo: require('./assets/svgs/headerLogo.svg').default
22-
});
21+
Assets.loadAssetsGroup('svgs.demo', {
22+
logo: require('./assets/svgs/headerLogo.svg').default
23+
});
2324

24-
Typography.loadTypographies({
25-
h1: {...Typography.text40},
26-
h2: {...Typography.text50},
27-
h3: {...Typography.text70M},
28-
body: Typography.text70,
29-
bodySmall: Typography.text80
30-
});
25+
Typography.loadTypographies({
26+
h1: {...Typography.text40},
27+
h2: {...Typography.text50},
28+
h3: {...Typography.text70M},
29+
body: Typography.text70,
30+
bodySmall: Typography.text80
31+
});
3132

32-
Spacings.loadSpacings({
33-
page: Spacings.s5
34-
});
33+
Spacings.loadSpacings({
34+
page: Spacings.s5
35+
});
3536

36-
/* Dark Mode Schemes */
37-
Colors.loadSchemes({
38-
light: {
39-
screenBG: Colors.white,
40-
textColor: Colors.grey10,
41-
moonOrSun: Colors.yellow30,
42-
mountainForeground: Colors.green30,
43-
mountainBackground: Colors.green50
44-
},
45-
dark: {
46-
screenBG: Colors.grey10,
47-
textColor: Colors.white,
48-
moonOrSun: Colors.grey80,
49-
mountainForeground: Colors.violet10,
50-
mountainBackground: Colors.violet20
51-
}
52-
});
37+
/* Dark Mode Schemes */
38+
Colors.loadSchemes({
39+
light: {
40+
screenBG: Colors.white,
41+
textColor: Colors.grey10,
42+
moonOrSun: Colors.yellow30,
43+
mountainForeground: Colors.green30,
44+
mountainBackground: Colors.green50
45+
},
46+
dark: {
47+
screenBG: Colors.grey10,
48+
textColor: Colors.white,
49+
moonOrSun: Colors.grey80,
50+
mountainForeground: Colors.violet10,
51+
mountainBackground: Colors.violet20
52+
}
53+
});
5354

54-
/* Components */
55-
Incubator.TextField.defaultProps = {...Incubator.TextField.defaultProps, preset: 'default'};
55+
/* Components */
56+
Incubator.TextField.defaultProps = {...Incubator.TextField.defaultProps, preset: 'default'};
57+
};

demo/src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import {UIManager, I18nManager} from 'react-native';
22
import {navigationData as menuStructure} from './screens/MenuStructure';
3+
import {loadDemoConfigurations} from './configurations';
34

45
UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true); // eslint-disable-line
56
I18nManager.allowRTL(true);
67

78
module.exports = {
89
name: 'unicorn demo app',
910
menuStructure,
11+
loadDemoConfigurations,
1012
// componentScreens
1113
get screens() {
1214
return {

demo/src/screens/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {gestureHandlerRootHOC} from 'react-native-gesture-handler';
22

33
export function registerScreens(registrar) {
44
// load demo app presets
5-
require('../configurations');
5+
require('../configurations').loadDemoConfigurations();
66

77
require('./componentScreens').registerScreens(registrar);
88
require('./foundationScreens').registerScreens(registrar);

0 commit comments

Comments
 (0)