1- // Copyright (c) Microsoft Corporation.
1+ // Copyright (c) Microsoft Corporation.
22// Licensed under the MIT License.
33
44import React from "react" ;
@@ -10,18 +10,21 @@ import {
1010 View ,
1111 Text ,
1212 StatusBar ,
13+ Pressable ,
1314} from "react-native" ;
1415
1516import {
1617 Colors ,
1718 Header ,
1819} from "react-native/Libraries/NewAppScreen" ;
1920
21+ import { showNotification } from './Notifications'
22+
2023async function updateJumpListAsync ( ) : Promise < void > {
2124 try {
2225 const StartScreenApi = Windows . UI . StartScreen ;
2326 const jumplist = await StartScreenApi . JumpList . loadCurrentAsync ( ) ;
24-
27+
2528 jumplist . systemGroupKind = StartScreenApi . JumpListSystemGroupKind . recent ;
2629
2730 const items = jumplist . items ;
@@ -97,7 +100,7 @@ async function getPictureThumbnailAsync(): Promise<string> {
97100
98101 const library = StorageApi . KnownFolders . picturesLibrary ;
99102 let files = await library . getFilesAsync ( ) ;
100-
103+
101104 let file : StorageApi . StorageFile | null = null ;
102105 if ( files . size > 0 ) {
103106 file = files . getAt ( 0 ) ;
@@ -199,6 +202,27 @@ const App = () => {
199202 </ Text >
200203 </ View >
201204 </ View >
205+ < View style = { styles . body } >
206+ < View style = { styles . sectionContainer } >
207+ < Text style = { styles . sectionTitle } > Windows.UI.Notifications Example</ Text >
208+ < View style = { { flexDirection : 'row' , flexWrap : 'wrap' , alignItems : 'center' } } >
209+ < Text style = { [ { paddingRight : 10 } , styles . sectionDescription ] } > Click the button to show a notification: </ Text >
210+ < Pressable style = { styles . sectionDescriptionButton } onPress = { ( ) => {
211+ showNotification ( {
212+ template : Windows . UI . Notifications . ToastTemplateType . toastImageAndText01 ,
213+ // The template schema can be found at https://docs.microsoft.com/previous-versions/windows/apps/hh761494(v=win.10)
214+ text : "hello world" ,
215+ image : {
216+ src : "https://microsoft.github.io/react-native-windows/img/header_logo.svg" ,
217+ alt : "React logo" ,
218+ }
219+ } ) ;
220+ } } >
221+ < Text style = { styles . sectionDescriptionButtonText } > Press</ Text >
222+ </ Pressable >
223+ </ View >
224+ </ View >
225+ </ View >
202226 < View style = { styles . body } >
203227 < View style = { styles . sectionContainer } >
204228 < Text style = { styles . sectionTitle } > Windows.Storage API + picturesLibrary capability Example</ Text >
@@ -241,6 +265,19 @@ const styles = StyleSheet.create({
241265 fontWeight : "400" ,
242266 color : Colors . dark ,
243267 } ,
268+ sectionDescriptionButton : {
269+ alignItems : 'center' ,
270+ justifyContent : 'center' ,
271+ paddingVertical : 4 ,
272+ paddingHorizontal : 24 ,
273+ borderRadius : 1 ,
274+ backgroundColor : Colors . light ,
275+ } ,
276+ sectionDescriptionButtonText : {
277+ fontSize : 18 ,
278+ fontWeight : "400" ,
279+ color : Colors . dark ,
280+ } ,
244281 highlight : {
245282 fontWeight : "700" ,
246283 } ,
0 commit comments