Skip to content

Commit 93a1c07

Browse files
committed
Merge branch 'master' into release
2 parents 12a9a64 + 56c5801 commit 93a1c07

File tree

97 files changed

+2242
-697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2242
-697
lines changed

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import com.android.build.OutputFile
44

55
project.ext.react = [
66
entryFile: "index.js",
7-
enableHermes: false, // clean and rebuild if changing
7+
enableHermes: true, // clean and rebuild if changing
88
]
99

1010
apply from: "../../node_modules/react-native/react.gradle"

android/app/src/main/java/com/rnuilib/MainApplication.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import com.wix.reactnativeuilib.UiLibPackageList;
1212
import java.lang.reflect.InvocationTargetException;
1313
import java.util.List;
14+
import com.facebook.react.bridge.JSIModulePackage;
15+
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
1416

1517

1618
public class MainApplication extends NavigationApplication {
@@ -21,6 +23,11 @@ protected String getJSMainModuleName() {
2123
return "demo";
2224
}
2325

26+
@Override
27+
protected JSIModulePackage getJSIModulePackage() {
28+
return new ReanimatedJSIModulePackage();
29+
}
30+
2431
@Override
2532
public boolean getUseDeveloperSupport() {
2633
return BuildConfig.DEBUG;

babel.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
module.exports = {
22
env: {
33
test: {
4-
presets: ['module:metro-react-native-babel-preset']
4+
presets: ['module:metro-react-native-babel-preset'],
5+
plugins: ['react-native-reanimated/plugin']
56
}
67
},
7-
presets: ['module:metro-react-native-babel-preset']
8+
presets: ['module:metro-react-native-babel-preset'],
9+
plugins: ['react-native-reanimated/plugin']
810
};

demo/src/configurations.js

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

33
Assets.loadAssetsGroup('icons.demo', {
44
add: require('./assets/icons/add.png'),
@@ -17,9 +17,31 @@ Assets.loadAssetsGroup('images.demo', {
1717
Typography.loadTypographies({
1818
h1: {...Typography.text40},
1919
h2: {...Typography.text50},
20-
h3: {...Typography.text60}
20+
h3: {...Typography.text60},
21+
body: Typography.text70
2122
});
2223

2324
Spacings.loadSpacings({
2425
page: Spacings.s5
2526
});
27+
28+
/* Dark Mode Schemes */
29+
Colors.loadSchemes({
30+
light: {
31+
screenBG: 'transparent',
32+
textColor: Colors.grey10,
33+
moonOrSun: Colors.yellow30,
34+
mountainForeground: Colors.green30,
35+
mountainBackground: Colors.green50
36+
},
37+
dark: {
38+
screenBG: Colors.grey10,
39+
textColor: Colors.white,
40+
moonOrSun: Colors.grey80,
41+
mountainForeground: Colors.violet10,
42+
mountainBackground: Colors.violet20
43+
}
44+
});
45+
46+
/* Components */
47+
Incubator.TextField.defaultProps = {...Incubator.TextField.defaultProps, preset: 'default'};

demo/src/screens/MenuStructure.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const navigationData = {
44
screens: [
55
{title: 'Border Radius', tags: 'corener border radius circle', screen: 'unicorn.style.BorderRadiusesScreen'},
66
{title: 'Colors', tags: 'palette rgb hex', screen: 'unicorn.style.ColorsScreen'},
7+
{title: 'Dark Mode', tags: 'dark mode colors', screen: 'unicorn.style.DarkModeScreen'},
78
{title: 'Shadows (iOS)', tags: 'shadow', screen: 'unicorn.style.ShadowsScreen'},
89
{title: 'Spacings', tags: 'space margins paddings gutter', screen: 'unicorn.style.SpacingsScreen'},
910
{title: 'Typography', tags: 'fonts text', screen: 'unicorn.style.TypographyScreen'}

demo/src/screens/componentScreens/ExpandableSectionScreen.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,11 @@ class ExpandableSectionScreen extends PureComponent {
6262

6363
getHeaderElement() {
6464
return (
65-
<View>
66-
<Text margin-10 dark10 text60>
65+
<View margin-10 spread row>
66+
<Text dark10 text60>
6767
ExpandableSection's sectionHeader
6868
</Text>
69-
<View style={styles.header}>
70-
<Image style={styles.icon} source={this.getChevron()} />
71-
</View>
69+
<Image style={styles.icon} source={this.getChevron()}/>
7270
</View>
7371
);
7472
}
@@ -124,12 +122,7 @@ class ExpandableSectionScreen extends PureComponent {
124122
export default ExpandableSectionScreen;
125123

126124
const styles = StyleSheet.create({
127-
header: {
128-
marginLeft: 380,
129-
marginTop: 20,
130-
position: 'absolute'
131-
},
132125
icon: {
133-
backgroundColor: 'transparent'
126+
alignSelf: 'center'
134127
}
135128
});

demo/src/screens/componentScreens/FeatureHighlightScreen.js

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React, {Component} from 'react';
33
import {AccessibilityInfo, findNodeHandle} from 'react-native';
44
import {Colors, Typography, View, Text, Button, FeatureHighlight} from 'react-native-ui-lib'; // eslint-disable-line
55

6-
76
const titles = [
87
'Get Notified',
98
'Title two is a long title that will not get cut by default, but can be limited',
@@ -14,18 +13,17 @@ const titles = [
1413
];
1514
const messages = [
1615
'Important notifications appear right on your clubs and groups. Tap them to get more information about the most' +
17-
'important things that you should pay attention to.',
16+
'important things that you should pay attention to.',
1817
'Short message with information about the above highlighted feature',
1918
'A long message, that will not get cut (but can be limited) with information about the highlighted feature.' +
20-
' Please note that if the message is too long and will cause the content box to render off screen, you will get a' +
21-
' warning about it',
19+
' Please note that if the message is too long and will cause the content box to render off screen, you will get a' +
20+
' warning about it',
2221
'Very short message',
2322
'Short message with information about the below highlighted feature',
2423
'Here is where you can view demos of all Uilib components'
2524
];
2625

2726
class FeatureHighlightScreen extends Component {
28-
2927
constructor(props) {
3028
super(props);
3129

@@ -51,11 +49,11 @@ class FeatureHighlightScreen extends Component {
5149
AccessibilityInfo.setAccessibilityFocus(reactTag);
5250
}
5351
});
54-
}
52+
};
5553

5654
showHighlight = () => {
5755
this.setState({showFTE: true});
58-
}
56+
};
5957

6058
addTarget(ref, id) {
6159
if (ref && !this.targets[id]) {
@@ -68,7 +66,7 @@ class FeatureHighlightScreen extends Component {
6866
const newTargetIndex = currentTargetIndex + 1;
6967

7068
this.moveToPage(newTargetIndex);
71-
}
69+
};
7270

7371
moveToPage(index) {
7472
if (index < _.size(this.targets)) {
@@ -80,18 +78,18 @@ class FeatureHighlightScreen extends Component {
8078

8179
getPageControlProps() {
8280
return {
83-
numOfPages: titles.length,
84-
currentPage: this.state.currentTargetIndex,
81+
numOfPages: titles.length,
82+
currentPage: this.state.currentTargetIndex,
8583
onPagePress: this.onPagePress,
8684
color: Colors.dark30,
8785
inactiveColor: Colors.dark80,
8886
size: 8
8987
};
9088
}
9189

92-
onPagePress = (index) => {
90+
onPagePress = index => {
9391
this.moveToPage(index);
94-
}
92+
};
9593

9694
renderHighlighterOverlay() {
9795
const {showFTE, currentTargetIndex} = this.state;
@@ -103,13 +101,15 @@ class FeatureHighlightScreen extends Component {
103101
title={titles[currentTargetIndex]}
104102
message={messages[currentTargetIndex]}
105103
titleStyle={currentTargetIndex === lastPage ? {...Typography.text70} : undefined}
106-
messageStyle={currentTargetIndex === lastPage ? {...Typography.text60, fontWeight: '900', lineHeight: 28} : undefined}
104+
messageStyle={
105+
currentTargetIndex === lastPage ? {...Typography.text60, fontWeight: '900', lineHeight: 28} : undefined
106+
}
107107
confirmButtonProps={{label: 'Got It', onPress: this.moveNext}}
108108
onBackgroundPress={this.closeHighlight}
109109
getTarget={() => this.targets[currentTargetIndex]}
110110
// highlightFrame={{x: 30, y: 70, width: 150, height: 30}}
111111
// highlightFrame={{x: 160, y: 336, width: 150, height: 56}}
112-
borderRadius={currentTargetIndex === 4 ? 4 : undefined}
112+
borderRadius={_.includes([1, 2, 3, 4], currentTargetIndex) ? 4 : undefined}
113113
pageControlProps={currentTargetIndex < lastPage ? this.getPageControlProps() : undefined}
114114
/>
115115
);
@@ -121,42 +121,53 @@ class FeatureHighlightScreen extends Component {
121121
<View row flex>
122122
<View left>
123123
<View
124-
marginT-40 br100 bg-yellow10
124+
marginT-40
125+
br100
126+
bg-yellow10
125127
style={{width: 32, height: 32}}
126128
testID={'0'}
127-
ref={r => (this.addTarget(r, '0'))}
129+
ref={r => this.addTarget(r, '0')}
128130
/>
129-
<View marginT-40 bg-red10 style={{width: 12, height: 12}} testID={'1'} ref={r => (this.addTarget(r, '1'))}/>
131+
<View marginT-40 bg-red10 style={{width: 12, height: 12}} testID={'1'} ref={r => this.addTarget(r, '1')}/>
130132
</View>
131133
<View right flex>
132134
<View row flex>
133135
<View
134-
marginT-40 marginR-60 bg-cyan30
136+
marginT-40
137+
marginR-60
138+
bg-cyan30
135139
style={{width: 50, height: 70}}
136140
testID={'2'}
137-
ref={r => (this.addTarget(r, '2'))}
141+
ref={r => this.addTarget(r, '2')}
142+
/>
143+
<View
144+
marginT-40
145+
bg-violet30
146+
style={{width: 70, height: 50}}
147+
testID={'3'}
148+
ref={r => this.addTarget(r, '3')}
138149
/>
139-
<View marginT-40 bg-violet30 style={{width: 70, height: 50}} testID={'3'} ref={r => (this.addTarget(r, '3'))}/>
140150
</View>
141151
<View
142-
marginT-40 marginR-50
152+
marginT-40
153+
marginR-50
143154
bg-purple40
144155
style={{width: 150, height: 56}}
145156
testID={'4'}
146-
ref={r => (this.addTarget(r, '4'))}
157+
ref={r => this.addTarget(r, '4')}
147158
/>
148159
</View>
149160
</View>
150161
<View center padding-25>
151-
<View ref={r => this.viewRef = r}>
162+
<View ref={r => (this.viewRef = r)}>
152163
<Text marginT-20>
153164
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
154-
industry&apos;s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
155-
scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap
165+
industry&apos;s standard dummy text ever since the 1500s, when an unknown printer took a galley of type
166+
and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap
156167
into electronic typesetting, <Text>remaining</Text> essentially unchanged.
157168
</Text>
158169
</View>
159-
<View marginT-20 testID={'5'} ref={r => (this.addTarget(r, '5'))}>
170+
<View marginT-20 testID={'5'} ref={r => this.addTarget(r, '5')}>
160171
<Button label="Show Overlay" onPress={this.showHighlight}/>
161172
</View>
162173
</View>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import React, {Component} from 'react';
2+
import {StyleSheet} from 'react-native';
3+
import {View, Text, Constants} from 'react-native-ui-lib';
4+
5+
class DarkModeScreen extends Component {
6+
state = {};
7+
render() {
8+
return (
9+
<View flex padding-page bg-screenBG>
10+
<Text h1 textColor>
11+
Dark Mode
12+
</Text>
13+
{Constants.isIOS ? (
14+
<Text marginT-s2 body textColor>
15+
Change to dark mode in simulator by pressing Cmd+Shift+A
16+
</Text>
17+
) : (
18+
<Text marginT-s2 body textColor>Change to dark mode</Text>
19+
)}
20+
21+
<View style={styles.moonOrSun} bg-moonOrSun/>
22+
<View style={[styles.mountain, styles.mountainBackground]} bg-mountainBackground/>
23+
<View style={[styles.mountain, styles.mountainForeground]} bg-mountainForeground/>
24+
</View>
25+
);
26+
}
27+
}
28+
29+
const styles = StyleSheet.create({
30+
mountain: {
31+
position: 'absolute',
32+
width: 1000,
33+
height: 1000,
34+
borderRadius: 500
35+
},
36+
mountainForeground: {
37+
left: -500,
38+
bottom: -800
39+
},
40+
mountainBackground: {
41+
right: -500,
42+
bottom: -850
43+
},
44+
moonOrSun: {
45+
position: 'absolute',
46+
right: 50,
47+
bottom: 350,
48+
width: 100,
49+
height: 100,
50+
borderRadius: 50
51+
}
52+
});
53+
54+
export default DarkModeScreen;

demo/src/screens/foundationScreens/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export function registerScreens(registrar) {
22
registrar('unicorn.style.BorderRadiusesScreen', () => require('./BorderRadiusesScreen').default);
33
registrar('unicorn.style.ColorsScreen', () => require('./ColorsScreen').default);
4+
registrar('unicorn.style.DarkModeScreen', () => require('./DarkModeScreen').default);
45
registrar('unicorn.style.TypographyScreen', () => require('./TypographyScreen').default);
56
registrar('unicorn.style.ShadowsScreen', () => require('./ShadowsScreen').default);
67
registrar('unicorn.style.SpacingsScreen', () => require('./SpacingsScreen').default);

eslint-rules/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ module.exports = {
66
'assets-deprecation': require('./lib/rules/assets-deprecation'),
77
'typography-deprecation': require('./lib/rules/typography-deprecation'),
88
'function-deprecation': require('./lib/rules/function-deprecation'),
9+
'prop-value-shape-deprecation': require('./lib/rules/prop-value-shape-deprecation'),
910
// for duplicate rules usage
1011
'component-deprecation_warn': require('./lib/rules/component-deprecation'),
1112
'assets-deprecation_warn': require('./lib/rules/assets-deprecation'),
1213
'typography-deprecation_warn': require('./lib/rules/typography-deprecation'),
1314
'function-deprecation_warn': require('./lib/rules/function-deprecation'),
15+
'prop-value-shape-deprecation_warn': require('./lib/rules/prop-value-shape-deprecation'),
1416
'component-deprecation_error': require('./lib/rules/component-deprecation'),
1517
'assets-deprecation_error': require('./lib/rules/assets-deprecation'),
1618
'typography-deprecation_error': require('./lib/rules/typography-deprecation'),
1719
'function-deprecation_error': require('./lib/rules/function-deprecation'),
18-
},
20+
'prop-value-shape-deprecation_error': require('./lib/rules/prop-value-shape-deprecation')
21+
}
1922
};

0 commit comments

Comments
 (0)