Skip to content

Commit

Permalink
refactor @wq/router for compat with expo-router
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed Aug 20, 2024
1 parent 0e26b77 commit d8ea672
Show file tree
Hide file tree
Showing 28 changed files with 16,037 additions and 17,365 deletions.
2 changes: 0 additions & 2 deletions packages/map-gl-native/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ export default {
preset: "jest-expo",
setupFiles: [
"./node_modules/@maplibre/maplibre-react-native/setup-jest.js",
"./setup-jest.js",
],
testMatch: ["**/__tests__/**/*.js?(x)"],
transformIgnorePatterns: [],
moduleNameMapper: { "@wq/material": "<rootDir>/setup-jest.js" },
};
12,947 changes: 7,015 additions & 5,932 deletions packages/map-gl-native/package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions packages/map-gl-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wq/map-gl-native",
"version": "2.0.0",
"version": "2.1.0",
"description": "React Native & Expo bindings for @wq/map-gl",
"type": "module",
"main": "src/index.js",
Expand Down Expand Up @@ -30,18 +30,18 @@
},
"homepage": "https://wq.io/@wq/map-gl",
"dependencies": {
"@turf/circle": "^6.5.0",
"@wq/map": "^2.0.0"
"@turf/circle": "^7.1.0",
"@wq/map": "^2.1.0"
},
"peerDependencies": {
"@maplibre/maplibre-react-native": "*",
"expo-location": "*",
"react-native-paper": "*"
},
"devDependencies": {
"@maplibre/maplibre-react-native": "github:maplibre/maplibre-react-native#a2b72b6",
"expo-location": "^16.1.0",
"jest-expo": "^49.0.0",
"react-native-paper": "^5.10.3"
"@maplibre/maplibre-react-native": "^10.0.0-alpha.10",
"expo-location": "^17.0.1",
"jest-expo": "^51.0.3",
"react-native-paper": "^5.12.5"
}
}
14 changes: 0 additions & 14 deletions packages/map-gl-native/setup-jest.js

This file was deleted.

19,505 changes: 8,550 additions & 10,955 deletions packages/material-native/package-lock.json

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions packages/material-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wq/material-native",
"version": "2.0.0",
"version": "2.1.0",
"description": "React Native and Expo bindings for @wq/material",
"type": "module",
"main": "src/index.js",
Expand Down Expand Up @@ -28,8 +28,8 @@
},
"homepage": "https://wq.io/@wq/material",
"dependencies": {
"@wq/react": "^2.0.0",
"date-fns": "^2.30.0"
"@wq/react": "^2.1.0",
"date-fns": "^3.6.0"
},
"peerDependencies": {
"@react-native-async-storage/async-storage": "*",
Expand All @@ -43,15 +43,15 @@
"react-native-picker-select": "*"
},
"devDependencies": {
"@react-native-async-storage/async-storage": "^1.19.1",
"@react-native-community/netinfo": "^9.4.1",
"@react-navigation/stack": "^6.3.17",
"expo-application": "^5.3.0",
"expo-document-picker": "^11.5.4",
"expo-image-picker": "^14.3.2",
"jest-expo": "^49.0.0",
"react-native-modal-datetime-picker": "^17.0.0",
"react-native-paper": "^5.10.1",
"react-native-picker-select": "github:Expensify/react-native-picker-select#eae0585"
"@react-native-async-storage/async-storage": "^1.24.0",
"@react-native-community/netinfo": "^11.3.2",
"@react-navigation/stack": "^6.4.1",
"expo-application": "^5.9.1",
"expo-document-picker": "^12.0.2",
"expo-image-picker": "^15.0.7",
"jest-expo": "^51.0.3",
"react-native-modal-datetime-picker": "^17.1.0",
"react-native-paper": "^5.12.5",
"react-native-picker-select": "^9.3.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useMemo } from "react";
import { App as DefaultApp, usePlugin } from "@wq/react";
import { Root as DefaultRoot } from "@wq/react";
import {
MD2LightTheme,
MD3LightTheme,
Expand All @@ -15,22 +15,13 @@ const THEMES = {
"dark-3": MD3DarkTheme,
};

export default function App() {
const { theme: configTheme } = usePlugin("material").config,
theme = useMemo(() => createTheme(configTheme), [configTheme]),
options = useMemo(
() => ({
navigator: { theme },
screen: {
cardStyle: { backgroundColor: theme.colors.background },
},
}),
[theme]
);
export default function Root({ app, children }) {
const { theme: configTheme } = app.plugins.material.config,
theme = useMemo(() => createTheme(configTheme), [configTheme]);

return (
<PaperProvider theme={theme}>
<DefaultApp options={options} />
<DefaultRoot app={app}>{children}</DefaultRoot>
</PaperProvider>
);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/material-native/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import react from "@wq/react";
import App from "./App.js";
import Root from "./Root.js";
import * as components from "./components/index.js";
import * as inputs from "./inputs/index.js";
import * as icons from "./icons.js";
Expand All @@ -21,7 +21,7 @@ export default {
},
},

components: { App, ...components },
components: { Root, ...components },
inputs: { ...inputs },
icons: { ...icons },

Expand All @@ -38,7 +38,7 @@ export default {
},
};

export { App };
export { Root };
export * from "./components/index.js";
export * from "./inputs/index.js";
export * from "./hooks.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/material-web/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/index.js
/App.js
/Root.js
/icons.js
/hooks.js
/components/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React, { useMemo } from "react";
import { App as DefaultApp, usePlugin } from "@wq/react";
import { Root as DefaultRoot, usePlugin } from "@wq/react";

Check failure on line 2 in packages/material-web/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/router

'DefaultRoot' is defined but never used

Check failure on line 2 in packages/material-web/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/map-gl-web

'DefaultRoot' is defined but never used

Check failure on line 2 in packages/material-web/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/map-gl

'DefaultRoot' is defined but never used

Check failure on line 2 in packages/material-web/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/map

'DefaultRoot' is defined but never used

Check failure on line 2 in packages/material-web/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/model

'DefaultRoot' is defined but never used

Check failure on line 2 in packages/material-web/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/react

'DefaultRoot' is defined but never used

Check failure on line 2 in packages/material-web/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/material-web

'DefaultRoot' is defined but never used

Check failure on line 2 in packages/material-web/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/material

'DefaultRoot' is defined but never used

Check failure on line 2 in packages/material-web/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/material-native

'DefaultRoot' is defined but never used

Check failure on line 2 in packages/material-web/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/outbox

'DefaultRoot' is defined but never used

Check failure on line 2 in packages/material-web/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/store

'DefaultRoot' is defined but never used

Check failure on line 2 in packages/material-web/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/app

'DefaultRoot' is defined but never used

Check failure on line 2 in packages/material-web/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/map-gl-native

'DefaultRoot' is defined but never used
import {
createTheme as createMuiTheme,
ThemeProvider,
CssBaseline,
} from "@mui/material";

export default function App() {
export default function Root({ app, children }) {
const { theme } = usePlugin("material").config,
muiTheme = useMemo(() => createTheme(theme), [theme]);
return (
<ThemeProvider theme={muiTheme}>
<CssBaseline />
<DefaultApp />
<Root app={app}>{children}</Root>
</ThemeProvider>
);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/material-web/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import react from "@wq/react";
import App from "./App.js";
import Root from "./Root.js";
import * as components from "./components/index.js";
import * as inputs from "./inputs/index.js";
import * as icons from "./icons.js";
Expand All @@ -21,7 +21,7 @@ export default {
},
},

components: { App, ...components },
components: { Root, ...components },
inputs: { ...inputs },
icons: { ...icons },

Expand All @@ -42,7 +42,7 @@ export default {
},
};

export { App };
export { Root };
export * from "./components/index.js";
export * from "./inputs/index.js";
export * from "./hooks.js";
Expand Down
4 changes: 1 addition & 3 deletions packages/react/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
/index.native.js
/index.expo.js
/App.js
/App.native.js
/Root.js
/hooks.js
/hooks.native.js
/icons.js
/init.js
/init.native.js
/messages.js
/validate.js
/components/
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wq/react",
"version": "2.1.0",
"version": "2.2.0",
"description": "React renderer for use with @wq/app",
"type": "module",
"main": "index.js",
Expand Down
72 changes: 0 additions & 72 deletions packages/react/src/App.native.js

This file was deleted.

12 changes: 12 additions & 0 deletions packages/react/src/Root.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Provider as StoreProvider } from "react-redux";
import { AppContext } from "./hooks.js";

export default function Root({ app, children }) {
return (
<StoreProvider store={app.store._store}>

Check failure on line 6 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/router

'React' must be in scope when using JSX

Check failure on line 6 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/map-gl-web

'React' must be in scope when using JSX

Check failure on line 6 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/map-gl

'React' must be in scope when using JSX

Check failure on line 6 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/map

'React' must be in scope when using JSX

Check failure on line 6 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/model

'React' must be in scope when using JSX

Check failure on line 6 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/react

'React' must be in scope when using JSX

Check failure on line 6 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/material-web

'React' must be in scope when using JSX

Check failure on line 6 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/material

'React' must be in scope when using JSX

Check failure on line 6 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/material-native

'React' must be in scope when using JSX

Check failure on line 6 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/outbox

'React' must be in scope when using JSX

Check failure on line 6 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/store

'React' must be in scope when using JSX

Check failure on line 6 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/app

'React' must be in scope when using JSX

Check failure on line 6 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/map-gl-native

'React' must be in scope when using JSX
<AppContext.Provider value={{ app }}>

Check failure on line 7 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/router

'React' must be in scope when using JSX

Check failure on line 7 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/map-gl-web

'React' must be in scope when using JSX

Check failure on line 7 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/map-gl

'React' must be in scope when using JSX

Check failure on line 7 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/map

'React' must be in scope when using JSX

Check failure on line 7 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/model

'React' must be in scope when using JSX

Check failure on line 7 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/react

'React' must be in scope when using JSX

Check failure on line 7 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/material-web

'React' must be in scope when using JSX

Check failure on line 7 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/material

'React' must be in scope when using JSX

Check failure on line 7 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/material-native

'React' must be in scope when using JSX

Check failure on line 7 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/outbox

'React' must be in scope when using JSX

Check failure on line 7 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/store

'React' must be in scope when using JSX

Check failure on line 7 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/app

'React' must be in scope when using JSX

Check failure on line 7 in packages/react/src/Root.js

View workflow job for this annotation

GitHub Actions / @wq/map-gl-native

'React' must be in scope when using JSX
{children}
</AppContext.Provider>
</StoreProvider>
);
}
Loading

0 comments on commit d8ea672

Please sign in to comment.