@fluentui-react-native/tester 0.79.7 → 0.80.0
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/CHANGELOG.json +22 -1
- package/CHANGELOG.md +11 -2
- package/lib/TestComponents/Notification/NotificationTest.d.ts.map +1 -1
- package/lib/TestComponents/Notification/NotificationTest.js +168 -67
- package/lib/TestComponents/Notification/NotificationTest.js.map +1 -1
- package/lib-commonjs/TestComponents/Notification/NotificationTest.d.ts.map +1 -1
- package/lib-commonjs/TestComponents/Notification/NotificationTest.js +167 -66
- package/lib-commonjs/TestComponents/Notification/NotificationTest.js.map +1 -1
- package/package.json +2 -2
- package/src/TestComponents/Notification/NotificationTest.tsx +232 -123
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,28 @@
|
|
|
2
2
|
"name": "@fluentui-react-native/tester",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Thu, 28 Jul 2022
|
|
5
|
+
"date": "Thu, 28 Jul 2022 21:20:13 GMT",
|
|
6
|
+
"tag": "@fluentui-react-native/tester_v0.80.0",
|
|
7
|
+
"version": "0.80.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "joannaquu@gmail.com",
|
|
12
|
+
"package": "@fluentui-react-native/tester",
|
|
13
|
+
"commit": "56f0d767d6ddcbd2b1ea94e41af5fce9c3953c48",
|
|
14
|
+
"comment": "add initial animation to notification"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui-react-native/tester",
|
|
19
|
+
"comment": "Bump @fluentui-react-native/notification to v0.10.0",
|
|
20
|
+
"commit": "56f0d767d6ddcbd2b1ea94e41af5fce9c3953c48"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Thu, 28 Jul 2022 16:25:20 GMT",
|
|
6
27
|
"tag": "@fluentui-react-native/tester_v0.79.7",
|
|
7
28
|
"version": "0.79.7",
|
|
8
29
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Change Log - @fluentui-react-native/tester
|
|
2
2
|
|
|
3
|
-
This log was last generated on Thu, 28 Jul 2022
|
|
3
|
+
This log was last generated on Thu, 28 Jul 2022 21:20:13 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.80.0
|
|
8
|
+
|
|
9
|
+
Thu, 28 Jul 2022 21:20:13 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- add initial animation to notification (joannaquu@gmail.com)
|
|
14
|
+
- Bump @fluentui-react-native/notification to v0.10.0
|
|
15
|
+
|
|
7
16
|
## 0.79.7
|
|
8
17
|
|
|
9
|
-
Thu, 28 Jul 2022 16:25:
|
|
18
|
+
Thu, 28 Jul 2022 16:25:20 GMT
|
|
10
19
|
|
|
11
20
|
### Patches
|
|
12
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationTest.d.ts","sourceRoot":"","sources":["../../../src/TestComponents/Notification/NotificationTest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NotificationTest.d.ts","sourceRoot":"","sources":["../../../src/TestComponents/Notification/NotificationTest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiR/B,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,iBAYpC,CAAC"}
|
|
@@ -1,89 +1,190 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Notification } from '@fluentui-react-native/notification';
|
|
2
|
+
import { Notification, NotificationVariants } from '@fluentui-react-native/notification';
|
|
3
3
|
import { Test } from '../Test';
|
|
4
|
+
import { Animated, StyleSheet, Switch, TextInput, View } from 'react-native';
|
|
5
|
+
import { Text } from '@fluentui-react-native/experimental-text';
|
|
6
|
+
import { ButtonV1 as Button } from '@fluentui-react-native/button';
|
|
7
|
+
import { StyledPicker } from '../Common/StyledPicker';
|
|
8
|
+
import { commonTestStyles as commonStyles } from '../Common/styles';
|
|
4
9
|
import PlayButton from './assets/play_button.svg';
|
|
5
10
|
var svgProps = {
|
|
6
11
|
src: PlayButton,
|
|
7
12
|
};
|
|
8
13
|
var iconProps = { svgSource: svgProps };
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
14
|
+
var SHOW_HEIGHT = -50;
|
|
15
|
+
var BAR_SHOW_DURATION = 300;
|
|
16
|
+
var HIDE_DURATION = 250;
|
|
17
|
+
var AUTO_HIDE_DURATION = 3000;
|
|
18
|
+
var USE_NATIVE_DRIVER_IOS = true;
|
|
19
|
+
var styles = StyleSheet.create({
|
|
20
|
+
button: {
|
|
21
|
+
alignSelf: 'center',
|
|
22
|
+
marginBottom: 50,
|
|
23
|
+
},
|
|
24
|
+
notification: {
|
|
25
|
+
marginTop: 10,
|
|
26
|
+
},
|
|
27
|
+
textInput: {
|
|
28
|
+
borderWidth: 1,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
var CustomToast = function () {
|
|
32
|
+
var _a = React.useState('primary'), variant = _a[0], setVariant = _a[1];
|
|
33
|
+
var _b = React.useState("Kat's iPhoneX"), title = _b[0], setTitle = _b[1];
|
|
34
|
+
var _c = React.useState('Listen to Emails • 7 mins'), message = _c[0], setMessage = _c[1];
|
|
35
|
+
var _d = React.useState('Listen'), action = _d[0], setAction = _d[1];
|
|
36
|
+
var _e = React.useState(true), showIcon = _e[0], setShowIcon = _e[1];
|
|
37
|
+
var _f = React.useState(true), showTitle = _f[0], setShowTitle = _f[1];
|
|
38
|
+
return (React.createElement(View, null,
|
|
39
|
+
React.createElement(StyledPicker, { prompt: "Variant", selected: variant, onChange: setVariant, collection: NotificationVariants.filter(function (variant) { return !variant.endsWith('Bar'); }) }),
|
|
40
|
+
React.createElement(TextInput, { value: title, onChangeText: setTitle, style: styles.textInput }),
|
|
41
|
+
React.createElement(TextInput, { value: message, onChangeText: setMessage, style: styles.textInput }),
|
|
42
|
+
React.createElement(TextInput, { value: action, onChangeText: setAction, style: styles.textInput }),
|
|
43
|
+
React.createElement(View, { style: commonStyles.switch },
|
|
44
|
+
React.createElement(Text, null, "Show icon "),
|
|
45
|
+
React.createElement(Switch, { value: showIcon, onValueChange: setShowIcon })),
|
|
46
|
+
React.createElement(View, { style: commonStyles.switch },
|
|
47
|
+
React.createElement(Text, null, "Show title "),
|
|
48
|
+
React.createElement(Switch, { value: showTitle, onValueChange: setShowTitle })),
|
|
49
|
+
React.createElement(View, { style: styles.notification },
|
|
50
|
+
React.createElement(Notification, { variant: variant, icon: showIcon ? iconProps : undefined, title: showTitle ? title : undefined, action: action, onPress: function () {
|
|
51
|
+
console.log('Notification tapped');
|
|
52
|
+
}, onActionPress: function () {
|
|
53
|
+
console.log('Notification action tapped');
|
|
54
|
+
} }, message))));
|
|
39
55
|
};
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
56
|
+
var CustomBar = function () {
|
|
57
|
+
var _a = React.useState('primaryBar'), variant = _a[0], setVariant = _a[1];
|
|
58
|
+
var _b = React.useState('Updating...'), message = _b[0], setMessage = _b[1];
|
|
59
|
+
return (React.createElement(View, null,
|
|
60
|
+
React.createElement(StyledPicker, { prompt: "Variant", selected: variant, onChange: setVariant, collection: NotificationVariants.filter(function (variant) { return variant.endsWith('Bar'); }) }),
|
|
61
|
+
React.createElement(TextInput, { value: message, onChangeText: setMessage, style: styles.textInput }),
|
|
62
|
+
React.createElement(View, { style: styles.notification },
|
|
63
|
+
React.createElement(Notification, { variant: variant, onPress: function () {
|
|
64
|
+
console.log('Notification tapped');
|
|
65
|
+
} }, message))));
|
|
44
66
|
};
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
67
|
+
var PrimaryWithAutoHide = function () {
|
|
68
|
+
var _a = React.useState(false), visible = _a[0], setVisible = _a[1];
|
|
69
|
+
var onButtonPress = function () { return setVisible(!visible); };
|
|
70
|
+
var _b = React.useState(!visible), hidden = _b[0], setHidden = _b[1];
|
|
71
|
+
var height = React.useRef(new Animated.Value(0)).current;
|
|
72
|
+
var show = function () {
|
|
73
|
+
setHidden(false);
|
|
74
|
+
Animated.sequence([
|
|
75
|
+
Animated.spring(height, {
|
|
76
|
+
toValue: SHOW_HEIGHT,
|
|
77
|
+
bounciness: 16,
|
|
78
|
+
speed: 20,
|
|
79
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
80
|
+
}),
|
|
81
|
+
Animated.delay(AUTO_HIDE_DURATION),
|
|
82
|
+
Animated.timing(height, {
|
|
83
|
+
toValue: 0,
|
|
84
|
+
duration: HIDE_DURATION,
|
|
85
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
86
|
+
}),
|
|
87
|
+
]).start(function () {
|
|
88
|
+
setHidden(true);
|
|
89
|
+
setVisible(false);
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
var hide = function () {
|
|
93
|
+
Animated.timing(height, {
|
|
94
|
+
toValue: 0,
|
|
95
|
+
duration: HIDE_DURATION,
|
|
96
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
97
|
+
}).start(function () {
|
|
98
|
+
setHidden(true);
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
React.useLayoutEffect(function () {
|
|
102
|
+
if (visible) {
|
|
103
|
+
show();
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
hide();
|
|
107
|
+
}
|
|
108
|
+
}, [visible, height]);
|
|
109
|
+
var animatedViewProps = {
|
|
110
|
+
transform: [{ translateY: height }],
|
|
111
|
+
};
|
|
112
|
+
return (React.createElement(View, null,
|
|
113
|
+
React.createElement(Button, { appearance: "subtle", onClick: onButtonPress, style: styles.button }, visible ? 'Hide' : 'Show'),
|
|
114
|
+
!hidden && (React.createElement(Animated.View, { style: [animatedViewProps] },
|
|
115
|
+
React.createElement(Notification, { variant: 'primary', action: "Undo", onPress: function () {
|
|
116
|
+
console.log('Notification tapped');
|
|
117
|
+
}, onActionPress: function () {
|
|
118
|
+
console.log('Undo tapped');
|
|
119
|
+
} }, "Mail Archived")))));
|
|
49
120
|
};
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
121
|
+
var PrimaryBarWithAutoHide = function () {
|
|
122
|
+
var _a = React.useState(false), visible = _a[0], setVisible = _a[1];
|
|
123
|
+
var onButtonPress = function () { return setVisible(!visible); };
|
|
124
|
+
var _b = React.useState(!visible), hidden = _b[0], setHidden = _b[1];
|
|
125
|
+
var height = React.useRef(new Animated.Value(0)).current;
|
|
126
|
+
var show = function () {
|
|
127
|
+
setHidden(false);
|
|
128
|
+
Animated.sequence([
|
|
129
|
+
Animated.timing(height, {
|
|
130
|
+
toValue: SHOW_HEIGHT,
|
|
131
|
+
duration: BAR_SHOW_DURATION,
|
|
132
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
133
|
+
}),
|
|
134
|
+
Animated.delay(AUTO_HIDE_DURATION),
|
|
135
|
+
Animated.timing(height, {
|
|
136
|
+
toValue: 0,
|
|
137
|
+
duration: HIDE_DURATION,
|
|
138
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
139
|
+
}),
|
|
140
|
+
]).start(function () {
|
|
141
|
+
setHidden(true);
|
|
142
|
+
setVisible(false);
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
var hide = function () {
|
|
146
|
+
Animated.timing(height, {
|
|
147
|
+
toValue: 0,
|
|
148
|
+
duration: HIDE_DURATION,
|
|
149
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
150
|
+
}).start(function () {
|
|
151
|
+
setHidden(true);
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
React.useLayoutEffect(function () {
|
|
155
|
+
if (visible) {
|
|
156
|
+
show();
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
hide();
|
|
160
|
+
}
|
|
161
|
+
}, [visible, height]);
|
|
162
|
+
var animatedViewProps = {
|
|
163
|
+
transform: [{ translateY: height }],
|
|
164
|
+
};
|
|
165
|
+
return (React.createElement(View, null,
|
|
166
|
+
React.createElement(Button, { appearance: "subtle", onClick: onButtonPress, style: styles.button }, visible ? 'Hide' : 'Show'),
|
|
167
|
+
!hidden && (React.createElement(Animated.View, { style: [animatedViewProps] },
|
|
168
|
+
React.createElement(Notification, { variant: 'primaryBar', onPress: function () {
|
|
169
|
+
console.log('Notification tapped');
|
|
170
|
+
} }, "Mail Sent")))));
|
|
54
171
|
};
|
|
55
172
|
var notificationSections = [
|
|
56
173
|
{
|
|
57
|
-
name: '
|
|
58
|
-
component:
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: 'Primary with Title and Icon',
|
|
62
|
-
component: PrimaryTestWithTitleAndIcon,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
name: 'Neutral',
|
|
66
|
-
component: NeutralTest,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: 'Danger',
|
|
70
|
-
component: DangerTest,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: 'Warning',
|
|
74
|
-
component: WarningTest,
|
|
174
|
+
name: 'Custom Toast',
|
|
175
|
+
component: CustomToast,
|
|
75
176
|
},
|
|
76
177
|
{
|
|
77
|
-
name: '
|
|
78
|
-
component:
|
|
178
|
+
name: 'Custom Bar',
|
|
179
|
+
component: CustomBar,
|
|
79
180
|
},
|
|
80
181
|
{
|
|
81
|
-
name: 'Primary
|
|
82
|
-
component:
|
|
182
|
+
name: 'Primary with auto-hide',
|
|
183
|
+
component: PrimaryWithAutoHide,
|
|
83
184
|
},
|
|
84
185
|
{
|
|
85
|
-
name: '
|
|
86
|
-
component:
|
|
186
|
+
name: 'Primary Bar with auto-hide',
|
|
187
|
+
component: PrimaryBarWithAutoHide,
|
|
87
188
|
},
|
|
88
189
|
];
|
|
89
190
|
export var NotificationTest = function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationTest.js","sourceRoot":"","sources":["../../../src/TestComponents/Notification/NotificationTest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"NotificationTest.js","sourceRoot":"","sources":["../../../src/TestComponents/Notification/NotificationTest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAuB,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC9G,OAAO,EAAE,IAAI,EAA+B,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAChE,OAAO,EAAE,QAAQ,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,gB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AC,iBAAiB,CAAC;YACvC,oBAAC,YAAY,IACX,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE;oBACP,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;gBACrC,CAAC,gBAGY,CACD,CACjB,CACI,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,IAAM,oBAAoB,GAAkB;IAC1C;QACE,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,WAAW;KACvB;IACD;QACE,IAAI,EAAE,YAAY;QAClB,SAAS,EAAE,SAAS;KACrB;IACD;QACE,IAAI,EAAE,wBAAwB;QAC9B,SAAS,EAAE,mBAAmB;KAC/B;IACD;QACE,IAAI,EAAE,4BAA4B;QAClC,SAAS,EAAE,sBAAsB;KAClC;CACF,CAAC;AAEF,MAAM,CAAC,IAAM,gBAAgB,GAA4B;IACvD,IAAM,MAAM,GAAmB;QAC7B,WAAW,EAAE,SAAS;QACtB,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,cAAc;QACzB,WAAW,EAAE,SAAS;QACtB,aAAa,EAAE,SAAS;KACzB,CAAC;IAEF,IAAM,WAAW,GAAG,gCAAgC,CAAC;IAErD,OAAO,oBAAC,IAAI,IAAC,IAAI,EAAC,mBAAmB,EAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,GAAS,CAAC;AAC1H,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationTest.d.ts","sourceRoot":"","sources":["../../../src/TestComponents/Notification/NotificationTest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NotificationTest.d.ts","sourceRoot":"","sources":["../../../src/TestComponents/Notification/NotificationTest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiR/B,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,iBAYpC,CAAC"}
|
|
@@ -5,89 +5,190 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var React = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
var notification_1 = require("@fluentui-react-native/notification");
|
|
7
7
|
var Test_1 = require("../Test");
|
|
8
|
+
var react_native_1 = require("react-native");
|
|
9
|
+
var experimental_text_1 = require("@fluentui-react-native/experimental-text");
|
|
10
|
+
var button_1 = require("@fluentui-react-native/button");
|
|
11
|
+
var StyledPicker_1 = require("../Common/StyledPicker");
|
|
12
|
+
var styles_1 = require("../Common/styles");
|
|
8
13
|
var play_button_svg_1 = (0, tslib_1.__importDefault)(require("./assets/play_button.svg"));
|
|
9
14
|
var svgProps = {
|
|
10
15
|
src: play_button_svg_1.default,
|
|
11
16
|
};
|
|
12
17
|
var iconProps = { svgSource: svgProps };
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
18
|
+
var SHOW_HEIGHT = -50;
|
|
19
|
+
var BAR_SHOW_DURATION = 300;
|
|
20
|
+
var HIDE_DURATION = 250;
|
|
21
|
+
var AUTO_HIDE_DURATION = 3000;
|
|
22
|
+
var USE_NATIVE_DRIVER_IOS = true;
|
|
23
|
+
var styles = react_native_1.StyleSheet.create({
|
|
24
|
+
button: {
|
|
25
|
+
alignSelf: 'center',
|
|
26
|
+
marginBottom: 50,
|
|
27
|
+
},
|
|
28
|
+
notification: {
|
|
29
|
+
marginTop: 10,
|
|
30
|
+
},
|
|
31
|
+
textInput: {
|
|
32
|
+
borderWidth: 1,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
var CustomToast = function () {
|
|
36
|
+
var _a = React.useState('primary'), variant = _a[0], setVariant = _a[1];
|
|
37
|
+
var _b = React.useState("Kat's iPhoneX"), title = _b[0], setTitle = _b[1];
|
|
38
|
+
var _c = React.useState('Listen to Emails • 7 mins'), message = _c[0], setMessage = _c[1];
|
|
39
|
+
var _d = React.useState('Listen'), action = _d[0], setAction = _d[1];
|
|
40
|
+
var _e = React.useState(true), showIcon = _e[0], setShowIcon = _e[1];
|
|
41
|
+
var _f = React.useState(true), showTitle = _f[0], setShowTitle = _f[1];
|
|
42
|
+
return (React.createElement(react_native_1.View, null,
|
|
43
|
+
React.createElement(StyledPicker_1.StyledPicker, { prompt: "Variant", selected: variant, onChange: setVariant, collection: notification_1.NotificationVariants.filter(function (variant) { return !variant.endsWith('Bar'); }) }),
|
|
44
|
+
React.createElement(react_native_1.TextInput, { value: title, onChangeText: setTitle, style: styles.textInput }),
|
|
45
|
+
React.createElement(react_native_1.TextInput, { value: message, onChangeText: setMessage, style: styles.textInput }),
|
|
46
|
+
React.createElement(react_native_1.TextInput, { value: action, onChangeText: setAction, style: styles.textInput }),
|
|
47
|
+
React.createElement(react_native_1.View, { style: styles_1.commonTestStyles.switch },
|
|
48
|
+
React.createElement(experimental_text_1.Text, null, "Show icon "),
|
|
49
|
+
React.createElement(react_native_1.Switch, { value: showIcon, onValueChange: setShowIcon })),
|
|
50
|
+
React.createElement(react_native_1.View, { style: styles_1.commonTestStyles.switch },
|
|
51
|
+
React.createElement(experimental_text_1.Text, null, "Show title "),
|
|
52
|
+
React.createElement(react_native_1.Switch, { value: showTitle, onValueChange: setShowTitle })),
|
|
53
|
+
React.createElement(react_native_1.View, { style: styles.notification },
|
|
54
|
+
React.createElement(notification_1.Notification, { variant: variant, icon: showIcon ? iconProps : undefined, title: showTitle ? title : undefined, action: action, onPress: function () {
|
|
55
|
+
console.log('Notification tapped');
|
|
56
|
+
}, onActionPress: function () {
|
|
57
|
+
console.log('Notification action tapped');
|
|
58
|
+
} }, message))));
|
|
43
59
|
};
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
var CustomBar = function () {
|
|
61
|
+
var _a = React.useState('primaryBar'), variant = _a[0], setVariant = _a[1];
|
|
62
|
+
var _b = React.useState('Updating...'), message = _b[0], setMessage = _b[1];
|
|
63
|
+
return (React.createElement(react_native_1.View, null,
|
|
64
|
+
React.createElement(StyledPicker_1.StyledPicker, { prompt: "Variant", selected: variant, onChange: setVariant, collection: notification_1.NotificationVariants.filter(function (variant) { return variant.endsWith('Bar'); }) }),
|
|
65
|
+
React.createElement(react_native_1.TextInput, { value: message, onChangeText: setMessage, style: styles.textInput }),
|
|
66
|
+
React.createElement(react_native_1.View, { style: styles.notification },
|
|
67
|
+
React.createElement(notification_1.Notification, { variant: variant, onPress: function () {
|
|
68
|
+
console.log('Notification tapped');
|
|
69
|
+
} }, message))));
|
|
48
70
|
};
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
71
|
+
var PrimaryWithAutoHide = function () {
|
|
72
|
+
var _a = React.useState(false), visible = _a[0], setVisible = _a[1];
|
|
73
|
+
var onButtonPress = function () { return setVisible(!visible); };
|
|
74
|
+
var _b = React.useState(!visible), hidden = _b[0], setHidden = _b[1];
|
|
75
|
+
var height = React.useRef(new react_native_1.Animated.Value(0)).current;
|
|
76
|
+
var show = function () {
|
|
77
|
+
setHidden(false);
|
|
78
|
+
react_native_1.Animated.sequence([
|
|
79
|
+
react_native_1.Animated.spring(height, {
|
|
80
|
+
toValue: SHOW_HEIGHT,
|
|
81
|
+
bounciness: 16,
|
|
82
|
+
speed: 20,
|
|
83
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
84
|
+
}),
|
|
85
|
+
react_native_1.Animated.delay(AUTO_HIDE_DURATION),
|
|
86
|
+
react_native_1.Animated.timing(height, {
|
|
87
|
+
toValue: 0,
|
|
88
|
+
duration: HIDE_DURATION,
|
|
89
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
90
|
+
}),
|
|
91
|
+
]).start(function () {
|
|
92
|
+
setHidden(true);
|
|
93
|
+
setVisible(false);
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
var hide = function () {
|
|
97
|
+
react_native_1.Animated.timing(height, {
|
|
98
|
+
toValue: 0,
|
|
99
|
+
duration: HIDE_DURATION,
|
|
100
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
101
|
+
}).start(function () {
|
|
102
|
+
setHidden(true);
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
React.useLayoutEffect(function () {
|
|
106
|
+
if (visible) {
|
|
107
|
+
show();
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
hide();
|
|
111
|
+
}
|
|
112
|
+
}, [visible, height]);
|
|
113
|
+
var animatedViewProps = {
|
|
114
|
+
transform: [{ translateY: height }],
|
|
115
|
+
};
|
|
116
|
+
return (React.createElement(react_native_1.View, null,
|
|
117
|
+
React.createElement(button_1.ButtonV1, { appearance: "subtle", onClick: onButtonPress, style: styles.button }, visible ? 'Hide' : 'Show'),
|
|
118
|
+
!hidden && (React.createElement(react_native_1.Animated.View, { style: [animatedViewProps] },
|
|
119
|
+
React.createElement(notification_1.Notification, { variant: 'primary', action: "Undo", onPress: function () {
|
|
120
|
+
console.log('Notification tapped');
|
|
121
|
+
}, onActionPress: function () {
|
|
122
|
+
console.log('Undo tapped');
|
|
123
|
+
} }, "Mail Archived")))));
|
|
53
124
|
};
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
125
|
+
var PrimaryBarWithAutoHide = function () {
|
|
126
|
+
var _a = React.useState(false), visible = _a[0], setVisible = _a[1];
|
|
127
|
+
var onButtonPress = function () { return setVisible(!visible); };
|
|
128
|
+
var _b = React.useState(!visible), hidden = _b[0], setHidden = _b[1];
|
|
129
|
+
var height = React.useRef(new react_native_1.Animated.Value(0)).current;
|
|
130
|
+
var show = function () {
|
|
131
|
+
setHidden(false);
|
|
132
|
+
react_native_1.Animated.sequence([
|
|
133
|
+
react_native_1.Animated.timing(height, {
|
|
134
|
+
toValue: SHOW_HEIGHT,
|
|
135
|
+
duration: BAR_SHOW_DURATION,
|
|
136
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
137
|
+
}),
|
|
138
|
+
react_native_1.Animated.delay(AUTO_HIDE_DURATION),
|
|
139
|
+
react_native_1.Animated.timing(height, {
|
|
140
|
+
toValue: 0,
|
|
141
|
+
duration: HIDE_DURATION,
|
|
142
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
143
|
+
}),
|
|
144
|
+
]).start(function () {
|
|
145
|
+
setHidden(true);
|
|
146
|
+
setVisible(false);
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
var hide = function () {
|
|
150
|
+
react_native_1.Animated.timing(height, {
|
|
151
|
+
toValue: 0,
|
|
152
|
+
duration: HIDE_DURATION,
|
|
153
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
154
|
+
}).start(function () {
|
|
155
|
+
setHidden(true);
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
React.useLayoutEffect(function () {
|
|
159
|
+
if (visible) {
|
|
160
|
+
show();
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
hide();
|
|
164
|
+
}
|
|
165
|
+
}, [visible, height]);
|
|
166
|
+
var animatedViewProps = {
|
|
167
|
+
transform: [{ translateY: height }],
|
|
168
|
+
};
|
|
169
|
+
return (React.createElement(react_native_1.View, null,
|
|
170
|
+
React.createElement(button_1.ButtonV1, { appearance: "subtle", onClick: onButtonPress, style: styles.button }, visible ? 'Hide' : 'Show'),
|
|
171
|
+
!hidden && (React.createElement(react_native_1.Animated.View, { style: [animatedViewProps] },
|
|
172
|
+
React.createElement(notification_1.Notification, { variant: 'primaryBar', onPress: function () {
|
|
173
|
+
console.log('Notification tapped');
|
|
174
|
+
} }, "Mail Sent")))));
|
|
58
175
|
};
|
|
59
176
|
var notificationSections = [
|
|
60
177
|
{
|
|
61
|
-
name: '
|
|
62
|
-
component:
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
name: 'Primary with Title and Icon',
|
|
66
|
-
component: PrimaryTestWithTitleAndIcon,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: 'Neutral',
|
|
70
|
-
component: NeutralTest,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: 'Danger',
|
|
74
|
-
component: DangerTest,
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: 'Warning',
|
|
78
|
-
component: WarningTest,
|
|
178
|
+
name: 'Custom Toast',
|
|
179
|
+
component: CustomToast,
|
|
79
180
|
},
|
|
80
181
|
{
|
|
81
|
-
name: '
|
|
82
|
-
component:
|
|
182
|
+
name: 'Custom Bar',
|
|
183
|
+
component: CustomBar,
|
|
83
184
|
},
|
|
84
185
|
{
|
|
85
|
-
name: 'Primary
|
|
86
|
-
component:
|
|
186
|
+
name: 'Primary with auto-hide',
|
|
187
|
+
component: PrimaryWithAutoHide,
|
|
87
188
|
},
|
|
88
189
|
{
|
|
89
|
-
name: '
|
|
90
|
-
component:
|
|
190
|
+
name: 'Primary Bar with auto-hide',
|
|
191
|
+
component: PrimaryBarWithAutoHide,
|
|
91
192
|
},
|
|
92
193
|
];
|
|
93
194
|
var NotificationTest = function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationTest.js","sourceRoot":"","sources":["../../../src/TestComponents/Notification/NotificationTest.tsx"],"names":[],"mappings":";;;;AAAA,wDAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"NotificationTest.js","sourceRoot":"","sources":["../../../src/TestComponents/Notification/NotificationTest.tsx"],"names":[],"mappings":";;;;AAAA,wDAA+B;AAC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,CACnB;QACR,CAAC,MAAM,IAAI,CACV,oBAAC,uBAAQ,CAAC,IAAI,IAAC,KAAK,EAAE,CAAC,iBAAiB,CAAC;YACvC,oBAAC,2BAAY,IACX,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE;oBACP,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;gBACrC,CAAC,gBAGY,CACD,CACjB,CACI,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,IAAM,oBAAoB,GAAkB;IAC1C;QACE,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,WAAW;KACvB;IACD;QACE,IAAI,EAAE,YAAY;QAClB,SAAS,EAAE,SAAS;KACrB;IACD;QACE,IAAI,EAAE,wBAAwB;QAC9B,SAAS,EAAE,mBAAmB;KAC/B;IACD;QACE,IAAI,EAAE,4BAA4B;QAClC,SAAS,EAAE,sBAAsB;KAClC;CACF,CAAC;AAEK,IAAM,gBAAgB,GAA4B;IACvD,IAAM,MAAM,GAAmB;QAC7B,WAAW,EAAE,SAAS;QACtB,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,cAAc;QACzB,WAAW,EAAE,SAAS;QACtB,aAAa,EAAE,SAAS;KACzB,CAAC;IAEF,IAAM,WAAW,GAAG,gCAAgC,CAAC;IAErD,OAAO,oBAAC,WAAI,IAAC,IAAI,EAAC,mBAAmB,EAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,GAAS,CAAC;AAC1H,CAAC,CAAC;AAZW,QAAA,gBAAgB,oBAY3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-react-native/tester",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.80.0",
|
|
4
4
|
"description": "A test app to test FluentUI React Native Components during development",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Microsoft <fluentuinativeowners@microsoft.com>",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@fluentui-react-native/icon": "0.13.1",
|
|
57
57
|
"@fluentui-react-native/interactive-hooks": ">=0.17.3 <1.0.0",
|
|
58
58
|
"@fluentui-react-native/menu": "^1.0.17",
|
|
59
|
-
"@fluentui-react-native/notification": "0.
|
|
59
|
+
"@fluentui-react-native/notification": "0.10.0",
|
|
60
60
|
"@fluentui-react-native/stack": ">=0.7.1 <1.0.0",
|
|
61
61
|
"@fluentui-react-native/theme": ">=0.7.0 <1.0.0",
|
|
62
62
|
"@fluentui-react-native/theme-types": ">=0.18.0 <1.0.0",
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Notification } from '@fluentui-react-native/notification';
|
|
2
|
+
import { Notification, NotificationVariant, NotificationVariants } from '@fluentui-react-native/notification';
|
|
3
3
|
import { Test, TestSection, PlatformStatus } from '../Test';
|
|
4
|
+
import { Animated, StyleSheet, Switch, TextInput, View } from 'react-native';
|
|
5
|
+
import { Text } from '@fluentui-react-native/experimental-text';
|
|
6
|
+
import { ButtonV1 as Button } from '@fluentui-react-native/button';
|
|
7
|
+
import { StyledPicker } from '../Common/StyledPicker';
|
|
8
|
+
import { commonTestStyles as commonStyles } from '../Common/styles';
|
|
4
9
|
import { SvgIconProps } from '@fluentui-react-native/icon';
|
|
5
10
|
import PlayButton from './assets/play_button.svg';
|
|
6
11
|
|
|
@@ -9,156 +14,260 @@ const svgProps: SvgIconProps = {
|
|
|
9
14
|
};
|
|
10
15
|
const iconProps = { svgSource: svgProps };
|
|
11
16
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
onPress={() => {
|
|
18
|
-
console.log('Notification tapped');
|
|
19
|
-
}}
|
|
20
|
-
onActionPress={() => {
|
|
21
|
-
console.log('Undo tapped');
|
|
22
|
-
}}
|
|
23
|
-
>
|
|
24
|
-
Mail Archived
|
|
25
|
-
</Notification>
|
|
26
|
-
);
|
|
27
|
-
};
|
|
17
|
+
const SHOW_HEIGHT = -50;
|
|
18
|
+
const BAR_SHOW_DURATION = 300;
|
|
19
|
+
const HIDE_DURATION = 250;
|
|
20
|
+
const AUTO_HIDE_DURATION = 3000;
|
|
21
|
+
const USE_NATIVE_DRIVER_IOS = true;
|
|
28
22
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
);
|
|
42
|
-
};
|
|
23
|
+
const styles = StyleSheet.create({
|
|
24
|
+
button: {
|
|
25
|
+
alignSelf: 'center',
|
|
26
|
+
marginBottom: 50,
|
|
27
|
+
},
|
|
28
|
+
notification: {
|
|
29
|
+
marginTop: 10,
|
|
30
|
+
},
|
|
31
|
+
textInput: {
|
|
32
|
+
borderWidth: 1,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
43
35
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
onPress={() => {
|
|
50
|
-
console.log('Notification tapped');
|
|
51
|
-
}}
|
|
52
|
-
onActionPress={() => {
|
|
53
|
-
console.log('Sign in tapped');
|
|
54
|
-
}}
|
|
55
|
-
>
|
|
56
|
-
Some items require you to sign in to view them
|
|
57
|
-
</Notification>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
36
|
+
const CustomToast: React.FunctionComponent = () => {
|
|
37
|
+
const [variant, setVariant] = React.useState<NotificationVariant>('primary');
|
|
38
|
+
const [title, setTitle] = React.useState("Kat's iPhoneX");
|
|
39
|
+
const [message, setMessage] = React.useState('Listen to Emails • 7 mins');
|
|
40
|
+
const [action, setAction] = React.useState('Listen');
|
|
60
41
|
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
<Notification
|
|
64
|
-
variant={'danger'}
|
|
65
|
-
action="Retry"
|
|
66
|
-
onPress={() => {
|
|
67
|
-
console.log('Notification tapped');
|
|
68
|
-
}}
|
|
69
|
-
onActionPress={() => {
|
|
70
|
-
console.log('Retry tapped');
|
|
71
|
-
}}
|
|
72
|
-
>
|
|
73
|
-
There was a problem, and your recent changes may not have saved
|
|
74
|
-
</Notification>
|
|
75
|
-
);
|
|
76
|
-
};
|
|
42
|
+
const [showIcon, setShowIcon] = React.useState(true);
|
|
43
|
+
const [showTitle, setShowTitle] = React.useState(true);
|
|
77
44
|
|
|
78
|
-
const WarningTest: React.FunctionComponent = () => {
|
|
79
45
|
return (
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
46
|
+
<View>
|
|
47
|
+
<StyledPicker
|
|
48
|
+
prompt="Variant"
|
|
49
|
+
selected={variant}
|
|
50
|
+
onChange={setVariant}
|
|
51
|
+
collection={NotificationVariants.filter((variant) => !variant.endsWith('Bar'))}
|
|
52
|
+
/>
|
|
53
|
+
<TextInput value={title} onChangeText={setTitle} style={styles.textInput} />
|
|
54
|
+
<TextInput value={message} onChangeText={setMessage} style={styles.textInput} />
|
|
55
|
+
<TextInput value={action} onChangeText={setAction} style={styles.textInput} />
|
|
56
|
+
<View style={commonStyles.switch}>
|
|
57
|
+
<Text>Show icon </Text>
|
|
58
|
+
<Switch value={showIcon} onValueChange={setShowIcon} />
|
|
59
|
+
</View>
|
|
60
|
+
<View style={commonStyles.switch}>
|
|
61
|
+
<Text>Show title </Text>
|
|
62
|
+
<Switch value={showTitle} onValueChange={setShowTitle} />
|
|
63
|
+
</View>
|
|
64
|
+
<View style={styles.notification}>
|
|
65
|
+
<Notification
|
|
66
|
+
variant={variant}
|
|
67
|
+
icon={showIcon ? iconProps : undefined}
|
|
68
|
+
title={showTitle ? title : undefined}
|
|
69
|
+
action={action}
|
|
70
|
+
onPress={() => {
|
|
71
|
+
console.log('Notification tapped');
|
|
72
|
+
}}
|
|
73
|
+
onActionPress={() => {
|
|
74
|
+
console.log('Notification action tapped');
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
{message}
|
|
78
|
+
</Notification>
|
|
79
|
+
</View>
|
|
80
|
+
</View>
|
|
88
81
|
);
|
|
89
82
|
};
|
|
90
83
|
|
|
91
|
-
const
|
|
84
|
+
const CustomBar: React.FunctionComponent = () => {
|
|
85
|
+
const [variant, setVariant] = React.useState<NotificationVariant>('primaryBar');
|
|
86
|
+
const [message, setMessage] = React.useState('Updating...');
|
|
87
|
+
|
|
92
88
|
return (
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
<View>
|
|
90
|
+
<StyledPicker
|
|
91
|
+
prompt="Variant"
|
|
92
|
+
selected={variant}
|
|
93
|
+
onChange={setVariant}
|
|
94
|
+
collection={NotificationVariants.filter((variant) => variant.endsWith('Bar'))}
|
|
95
|
+
/>
|
|
96
|
+
<TextInput value={message} onChangeText={setMessage} style={styles.textInput} />
|
|
97
|
+
<View style={styles.notification}>
|
|
98
|
+
<Notification
|
|
99
|
+
variant={variant}
|
|
100
|
+
onPress={() => {
|
|
101
|
+
console.log('Notification tapped');
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
{message}
|
|
105
|
+
</Notification>
|
|
106
|
+
</View>
|
|
107
|
+
</View>
|
|
101
108
|
);
|
|
102
109
|
};
|
|
103
110
|
|
|
104
|
-
const
|
|
111
|
+
const PrimaryWithAutoHide: React.FunctionComponent = () => {
|
|
112
|
+
const [visible, setVisible] = React.useState(false);
|
|
113
|
+
const onButtonPress = () => setVisible(!visible);
|
|
114
|
+
|
|
115
|
+
const [hidden, setHidden] = React.useState<boolean>(!visible);
|
|
116
|
+
const height = React.useRef(new Animated.Value(0)).current;
|
|
117
|
+
|
|
118
|
+
const show = () => {
|
|
119
|
+
setHidden(false);
|
|
120
|
+
Animated.sequence([
|
|
121
|
+
Animated.spring(height, {
|
|
122
|
+
toValue: SHOW_HEIGHT,
|
|
123
|
+
bounciness: 16,
|
|
124
|
+
speed: 20,
|
|
125
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
126
|
+
}),
|
|
127
|
+
Animated.delay(AUTO_HIDE_DURATION),
|
|
128
|
+
Animated.timing(height, {
|
|
129
|
+
toValue: 0,
|
|
130
|
+
duration: HIDE_DURATION,
|
|
131
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
132
|
+
}),
|
|
133
|
+
]).start(() => {
|
|
134
|
+
setHidden(true);
|
|
135
|
+
setVisible(false);
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const hide = () => {
|
|
140
|
+
Animated.timing(height, {
|
|
141
|
+
toValue: 0,
|
|
142
|
+
duration: HIDE_DURATION,
|
|
143
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
144
|
+
}).start(() => {
|
|
145
|
+
setHidden(true);
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
React.useLayoutEffect(() => {
|
|
150
|
+
if (visible) {
|
|
151
|
+
show();
|
|
152
|
+
} else {
|
|
153
|
+
hide();
|
|
154
|
+
}
|
|
155
|
+
}, [visible, height]);
|
|
156
|
+
|
|
157
|
+
const animatedViewProps = {
|
|
158
|
+
transform: [{ translateY: height }],
|
|
159
|
+
};
|
|
160
|
+
|
|
105
161
|
return (
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
162
|
+
<View>
|
|
163
|
+
<Button appearance="subtle" onClick={onButtonPress} style={styles.button}>
|
|
164
|
+
{visible ? 'Hide' : 'Show'}
|
|
165
|
+
</Button>
|
|
166
|
+
{!hidden && (
|
|
167
|
+
<Animated.View style={[animatedViewProps]}>
|
|
168
|
+
<Notification
|
|
169
|
+
variant={'primary'}
|
|
170
|
+
action="Undo"
|
|
171
|
+
onPress={() => {
|
|
172
|
+
console.log('Notification tapped');
|
|
173
|
+
}}
|
|
174
|
+
onActionPress={() => {
|
|
175
|
+
console.log('Undo tapped');
|
|
176
|
+
}}
|
|
177
|
+
>
|
|
178
|
+
Mail Archived
|
|
179
|
+
</Notification>
|
|
180
|
+
</Animated.View>
|
|
181
|
+
)}
|
|
182
|
+
</View>
|
|
114
183
|
);
|
|
115
184
|
};
|
|
185
|
+
const PrimaryBarWithAutoHide: React.FunctionComponent = () => {
|
|
186
|
+
const [visible, setVisible] = React.useState(false);
|
|
187
|
+
const onButtonPress = () => setVisible(!visible);
|
|
188
|
+
|
|
189
|
+
const [hidden, setHidden] = React.useState<boolean>(!visible);
|
|
190
|
+
const height = React.useRef(new Animated.Value(0)).current;
|
|
191
|
+
|
|
192
|
+
const show = () => {
|
|
193
|
+
setHidden(false);
|
|
194
|
+
Animated.sequence([
|
|
195
|
+
Animated.timing(height, {
|
|
196
|
+
toValue: SHOW_HEIGHT,
|
|
197
|
+
duration: BAR_SHOW_DURATION,
|
|
198
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
199
|
+
}),
|
|
200
|
+
Animated.delay(AUTO_HIDE_DURATION),
|
|
201
|
+
Animated.timing(height, {
|
|
202
|
+
toValue: 0,
|
|
203
|
+
duration: HIDE_DURATION,
|
|
204
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
205
|
+
}),
|
|
206
|
+
]).start(() => {
|
|
207
|
+
setHidden(true);
|
|
208
|
+
setVisible(false);
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
const hide = () => {
|
|
213
|
+
Animated.timing(height, {
|
|
214
|
+
toValue: 0,
|
|
215
|
+
duration: HIDE_DURATION,
|
|
216
|
+
useNativeDriver: USE_NATIVE_DRIVER_IOS,
|
|
217
|
+
}).start(() => {
|
|
218
|
+
setHidden(true);
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
React.useLayoutEffect(() => {
|
|
223
|
+
if (visible) {
|
|
224
|
+
show();
|
|
225
|
+
} else {
|
|
226
|
+
hide();
|
|
227
|
+
}
|
|
228
|
+
}, [visible, height]);
|
|
229
|
+
|
|
230
|
+
const animatedViewProps = {
|
|
231
|
+
transform: [{ translateY: height }],
|
|
232
|
+
};
|
|
116
233
|
|
|
117
|
-
const NeutralBarTest: React.FunctionComponent = () => {
|
|
118
234
|
return (
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
235
|
+
<View>
|
|
236
|
+
<Button appearance="subtle" onClick={onButtonPress} style={styles.button}>
|
|
237
|
+
{visible ? 'Hide' : 'Show'}
|
|
238
|
+
</Button>
|
|
239
|
+
{!hidden && (
|
|
240
|
+
<Animated.View style={[animatedViewProps]}>
|
|
241
|
+
<Notification
|
|
242
|
+
variant={'primaryBar'}
|
|
243
|
+
onPress={() => {
|
|
244
|
+
console.log('Notification tapped');
|
|
245
|
+
}}
|
|
246
|
+
>
|
|
247
|
+
Mail Sent
|
|
248
|
+
</Notification>
|
|
249
|
+
</Animated.View>
|
|
250
|
+
)}
|
|
251
|
+
</View>
|
|
127
252
|
);
|
|
128
253
|
};
|
|
129
254
|
|
|
130
255
|
const notificationSections: TestSection[] = [
|
|
131
256
|
{
|
|
132
|
-
name: '
|
|
133
|
-
component:
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: 'Primary with Title and Icon',
|
|
137
|
-
component: PrimaryTestWithTitleAndIcon,
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
name: 'Neutral',
|
|
141
|
-
component: NeutralTest,
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
name: 'Danger',
|
|
145
|
-
component: DangerTest,
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: 'Warning',
|
|
149
|
-
component: WarningTest,
|
|
257
|
+
name: 'Custom Toast',
|
|
258
|
+
component: CustomToast,
|
|
150
259
|
},
|
|
151
260
|
{
|
|
152
|
-
name: '
|
|
153
|
-
component:
|
|
261
|
+
name: 'Custom Bar',
|
|
262
|
+
component: CustomBar,
|
|
154
263
|
},
|
|
155
264
|
{
|
|
156
|
-
name: 'Primary
|
|
157
|
-
component:
|
|
265
|
+
name: 'Primary with auto-hide',
|
|
266
|
+
component: PrimaryWithAutoHide,
|
|
158
267
|
},
|
|
159
268
|
{
|
|
160
|
-
name: '
|
|
161
|
-
component:
|
|
269
|
+
name: 'Primary Bar with auto-hide',
|
|
270
|
+
component: PrimaryBarWithAutoHide,
|
|
162
271
|
},
|
|
163
272
|
];
|
|
164
273
|
|