diff --git a/src/App/App.js b/src/App/App.js index 82b12d898..c7d23c300 100644 --- a/src/App/App.js +++ b/src/App/App.js @@ -2,7 +2,7 @@ require('spatial-navigation-polyfill'); const React = require('react'); const { Router } = require('stremio-router'); const { Core, KeyboardNavigation, ServicesProvider, Shell } = require('stremio/services'); -const { Toasts } = require('stremio/common'); +const { ToastProvider } = require('stremio/common'); const routerViewsConfig = require('./routerViewsConfig'); const styles = require('./styles'); @@ -51,14 +51,14 @@ const App = () => { { shellInitialized && coreInitialized ? - + - + :
} diff --git a/src/common/Toast/ToastContext.js b/src/common/Toast/ToastContext.js new file mode 100644 index 000000000..7418affbd --- /dev/null +++ b/src/common/Toast/ToastContext.js @@ -0,0 +1,10 @@ +const React = require('react'); + +const ToastContext = React.createContext({ + show: () => { }, + clear: () => { } +}); + +ToastContext.displayName = 'ToastContext'; + +module.exports = ToastContext; diff --git a/src/common/Toasts/Toast/Toast.js b/src/common/Toast/ToastItem/ToastItem.js similarity index 78% rename from src/common/Toasts/Toast/Toast.js rename to src/common/Toast/ToastItem/ToastItem.js index 8b4470c02..04ddbebe6 100644 --- a/src/common/Toasts/Toast/Toast.js +++ b/src/common/Toast/ToastItem/ToastItem.js @@ -5,7 +5,7 @@ const Icon = require('stremio-icons/dom'); const Button = require('stremio/common/Button'); const styles = require('./styles'); -const Toast = ({ type, title, message, icon, dataset, onSelect, onClose }) => { +const ToastItem = ({ type, title, message, icon, dataset, onSelect, onClose }) => { const toastOnClick = React.useCallback((event) => { if (!event.nativeEvent.selectPrevented && typeof onSelect === 'function') { onSelect({ @@ -28,7 +28,7 @@ const Toast = ({ type, title, message, icon, dataset, onSelect, onClose }) => { } }, [dataset, onClose]); return ( -