Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
aeharding committed Jan 4, 2025
1 parent 9ca444d commit 11a7e02
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
8 changes: 5 additions & 3 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { Provider } from "react-redux";
import App from "./App";
import "@testing-library/jest-dom";
import { createStore } from "./store";

test("renders learn react link", async () => {
import { MemoryRouter } from "react-router-dom";
test("renders", async () => {
const store = createStore();

render(
<Provider store={store}>
<App />
<MemoryRouter>
<App />
</MemoryRouter>
</Provider>,
);

Expand Down
8 changes: 2 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import styled from "@emotion/styled";
import Footer from "./Footer";
import WebHeader from "./header/web/Header";
import { BrowserRouter, MemoryRouter } from "react-router-dom";
import AppHeader from "./header/app/Header";
import Routes from "./Routes";
import HeaderRoutes from "./header/web/HeaderRoutes";
Expand Down Expand Up @@ -50,11 +49,8 @@ const Main = styled.main`
`;

function App() {
// Disable iOS swipe navigation when installed
const Router = isInstalled() ? MemoryRouter : BrowserRouter;

return (
<Router>
<>
<Global
styles={css`
:root {
Expand Down Expand Up @@ -85,7 +81,7 @@ function App() {
<Footer />
</AppContents>
</AppContainer>
</Router>
</>
);
}

Expand Down
11 changes: 10 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import "./setupViewport";
import "./i18n";

import { createRoot } from "react-dom/client";
import { BrowserRouter } from "react-router-dom";
import { isInstalled } from "./helpers/device";
import { MemoryRouter } from "react-router-dom";

const globalStyles = css`
:root {
Expand Down Expand Up @@ -87,11 +90,17 @@ const globalStyles = css`

const rootNode = document.getElementById("root");
const root = createRoot(rootNode!);

// Disable iOS swipe navigation when installed
const Router = isInstalled() ? MemoryRouter : BrowserRouter;

root.render(
<>
<Global styles={globalStyles} />
<Provider store={store}>
<App />
<Router>
<App />
</Router>
</Provider>
</>,
);

0 comments on commit 11a7e02

Please sign in to comment.