Skip to content

Commit 116b151

Browse files
committed
Update FeatureHighlight example screen
1 parent dbdb01f commit 116b151

File tree

1 file changed

+37
-26
lines changed

1 file changed

+37
-26
lines changed

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>

0 commit comments

Comments
 (0)