Last active
March 5, 2021 15:01
-
-
Save nolimits4web/352dc3f2fc8f2013b8ba0966c7fc9a29 to your computer and use it in GitHub Desktop.
Revisions
-
nolimits4web revised this gist
Mar 5, 2021 . 1 changed file with 10 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,14 @@ import "../styles/globals.css"; // Install Framework7 React plugin for Framework7 Framework7.use(Framework7React); // App routes const routes = [ { path: '/', asyncComponent: () => import('./index'), }, ]; function MyApp({ Component, pageProps }) { // current Next.js route const router = useRouter(); @@ -24,11 +32,11 @@ function MyApp({ Component, pageProps }) { return ( /* Here we pass initial server URL and routes to the Framework7's App. It is required because Framework7 will be initialized on server-side, and we need to know this URL to correctly load pages by Framework7 router */ <App url={url} routes={routes}> {/* Create main View. Apparently we need to enable browserHistory to navigating by URL -
nolimits4web revised this gist
Mar 5, 2021 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -49,4 +49,6 @@ function MyApp({ Component, pageProps }) { </View> </App> ); } export default MyApp; -
nolimits4web created this gist
Mar 5, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,52 @@ // Import Framework7 import Framework7 from "framework7/lite-bundle"; // Import Framework7-React and components import Framework7React, { App, View } from "framework7-react"; // Next router import { useRouter } from "next/router"; // Import icons and styles import "framework7/framework7-bundle.css"; import "framework7-icons/css/framework7-icons.css"; import "material-icons/iconfont/material-icons.css"; import "../styles/globals.css"; // Install Framework7 React plugin for Framework7 Framework7.use(Framework7React); function MyApp({ Component, pageProps }) { // current Next.js route const router = useRouter(); /* Here we need to know (mostly on server-side) on what URL user opens our app */ const url = `${process.env.NEXT_PUBLIC_HOST}${router.asPath}`; return ( /* Here we pass initial server URL to the Framework7's App. It is required because Framework7 will be initialized on server-side, and we need to know this URL to correctly load pages by Framework7 router */ <App url={url}> {/* Create main View. Apparently we need to enable browserHistory to navigating by URL */} <View main browserHistory browserHistorySeparator="" browserHistoryInitialMatch={true} browserHistoryStoreHistory={false} url="/" > {/* Initial page components (returned by Next.js). Here it is mandatory to set `initialPage` prop on it. */} <Component initialPage {...pageProps} /> </View> </App> ); }