Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

getting stuck with expo-notifications

$
0
0

I am trying to add notifications to my react native application .

i am not using eject

So i had to use expo-notifications library and all working fine.

from this project: github code

But it's in typescript and when i did implement it to my code it didn't work.

I tried almost anything i found in my way but nothing else worked except this code, any way to add it to

my app, or suggest me a working notification code please.

My App.js code :

/** @format */import React from "react";import { Font } from "@expo";import { Provider } from "react-redux";import { persistStore } from "redux-persist";import { PersistGate } from "redux-persist/es/integration/react";import store from "@store/configureStore";import RootRouter from "./src/Router";import "./ReactotronConfig";function cacheFonts(fonts) {  return fonts.map((font) => Font.loadAsync(font));}export default class App extends React.Component {  loadAssets = async () => {    const fontAssets = cacheFonts([      { OpenSans: require("@assets/fonts/OpenSans-Regular.ttf") },      { Baloo: require("@assets/fonts/Baloo-Regular.ttf") },      { Entypo: require("@expo/vector-icons/fonts/Entypo.ttf") },      {"Material Icons": require("@expo/vector-icons/fonts/MaterialIcons.ttf"),      },      {        MaterialCommunityIcons: require("@expo/vector-icons/fonts/MaterialCommunityIcons.ttf"),      },      {"Material Design Icons": require("@expo/vector-icons/fonts/MaterialCommunityIcons.ttf"),      },      { FontAwesome: require("@expo/vector-icons/fonts/FontAwesome.ttf") },      {"simple-line-icons": require("@expo/vector-icons/fonts/SimpleLineIcons.ttf"),      },      { Ionicons: require("@expo/vector-icons/fonts/Ionicons.ttf") },    ]);    // const imageAssets = cacheImages([    //   Images.icons.iconCard,    //   Images.icons.iconColumn,    //   Images.icons.iconLeft,    //   Images.icons.iconRight,    //   Images.icons.iconThree,    //   Images.icons.iconAdvance,    //   Images.icons.iconHorizal,    //   Images.icons.back,    //   Images.icons.home,    //   Images.IconSwitch,    //   Images.IconFilter,    //   Images.IconList,    //   Images.IconGrid,    //   Images.IconCard,    //   Images.IconSearch,    //   Images.IconHome,    //   Images.IconCategory,    //   Images.IconHeart,    //   Images.IconOrder,    //   Images.IconCart,    // ]);    await Promise.all([...fontAssets]);  };  componentDidMount() {    this.loadAssets();  }  render() {    const persistor = persistStore(store);    return (<Provider store={store}><PersistGate loading={null} persistor={persistor}><RootRouter /></PersistGate></Provider>    );  }}

PS: am using sdk 39, and i want the notification to be working on android and ios.

thanks for your time.


Viewing all articles
Browse latest Browse all 6287

Trending Articles