|
1 | 1 | import _ from 'lodash';
|
2 | 2 | import React, {Component} from 'react';
|
3 | 3 | import {Alert, ViewStyle} from 'react-native';
|
4 |
| -import {Colors, View, Text, Hint, Button, Assets, Incubator} from 'react-native-ui-lib'; |
| 4 | +import {Colors, View, Text, Hint, Button, Assets, Incubator, Constants} from 'react-native-ui-lib'; |
5 | 5 | import {renderMultipleSegmentOptions, renderBooleanOption} from '../ExampleScreenPresenter';
|
6 | 6 |
|
7 | 7 | const settingsIcon = require('../../assets/icons/settings.png');
|
8 | 8 | const reactions = ['❤️', '😮', '😔', '😂', '😡'];
|
9 | 9 |
|
10 | 10 | type HintScreenProps = {};
|
11 | 11 |
|
| 12 | +const SHORT_MESSAGE = 'Add other cool and useful stuff.'; |
| 13 | +const DEFAULT_MESSAGE = 'Add other cool and useful stuff through adding apps to your visitors to enjoy.'; |
| 14 | +const TARGET_FRAMES_MESSAGE = 'Press Back button to go to previous screen'; |
| 15 | + |
12 | 16 | export default class HintsScreen extends Component<HintScreenProps> {
|
13 | 17 | state = {
|
14 | 18 | showHint: true,
|
@@ -135,10 +139,14 @@ export default class HintsScreen extends Component<HintScreenProps> {
|
135 | 139 | showReactionStrip,
|
136 | 140 | enableShadow
|
137 | 141 | } = this.state;
|
138 |
| - const targetFrame = {x: 140, y: 100, width: 10, height: 10}; |
139 |
| - const message = useShortMessage |
140 |
| - ? 'Add other cool and useful stuff.' |
141 |
| - : 'Add other cool and useful stuff through adding apps to your visitors to enjoy.'; |
| 142 | + const targetFrame = { |
| 143 | + x: 20, |
| 144 | + y: Constants.getSafeAreaInsets().top + Constants.statusBarHeight, |
| 145 | + width: 1, |
| 146 | + height: 1 |
| 147 | + }; |
| 148 | + |
| 149 | + const message = useTargetFrame ? TARGET_FRAMES_MESSAGE : useShortMessage ? SHORT_MESSAGE : DEFAULT_MESSAGE; |
142 | 150 | const color = !showCustomContent && showReactionStrip ? {color: Colors.$backgroundDefault} : undefined;
|
143 | 151 |
|
144 | 152 | const hintKey = `${useSideTip}-${targetPosition}-${useShortMessage}-${showIcon}-${useTargetFrame}-${showCustomContent}-${showReactionStrip}`;
|
@@ -170,14 +178,14 @@ export default class HintsScreen extends Component<HintScreenProps> {
|
170 | 178 | icon={showIcon ? settingsIcon : undefined}
|
171 | 179 | // iconStyle={{tintColor: 'red'}}
|
172 | 180 | // offset={35}
|
173 |
| - position={showBottomHint ? Hint.positions.BOTTOM : Hint.positions.TOP} |
174 |
| - useSideTip={useSideTip} |
| 181 | + position={showBottomHint || useTargetFrame ? Hint.positions.BOTTOM : Hint.positions.TOP} |
| 182 | + useSideTip={useSideTip || useTargetFrame} |
175 | 183 | key={hintKey}
|
176 | 184 | onPress={this.onHintPressed}
|
177 | 185 | targetFrame={useTargetFrame ? targetFrame : undefined}
|
178 | 186 | // borderRadius={BorderRadiuses.br40}
|
179 | 187 | // edgeMargins={30}
|
180 |
| - onBackgroundPress={useBackdrop && !useTargetFrame ? this.toggleHint : undefined} |
| 188 | + onBackgroundPress={useBackdrop || useTargetFrame ? this.toggleHint : undefined} |
181 | 189 | backdropColor={Colors.rgba(Colors.$backgroundInverted, 0.3)}
|
182 | 190 | customContent={
|
183 | 191 | showCustomContent
|
@@ -207,17 +215,6 @@ export default class HintsScreen extends Component<HintScreenProps> {
|
207 | 215 |
|
208 | 216 | {useTargetFrame && (
|
209 | 217 | <>
|
210 |
| - <View |
211 |
| - bg-red50 |
212 |
| - style={{ |
213 |
| - position: 'absolute', |
214 |
| - top: targetFrame.y, |
215 |
| - left: targetFrame.x, |
216 |
| - width: targetFrame.width, |
217 |
| - height: targetFrame.height |
218 |
| - }} |
219 |
| - /> |
220 |
| - |
221 | 218 | <View absL absB margin-page>
|
222 | 219 | <Button label="Show Hint" onPress={this.toggleHint}/>
|
223 | 220 | </View>
|
|
0 commit comments