diff --git a/apps/tlon-mobile/package.json b/apps/tlon-mobile/package.json index a787995b16..74e9e57ba7 100644 --- a/apps/tlon-mobile/package.json +++ b/apps/tlon-mobile/package.json @@ -39,6 +39,9 @@ "@10play/tentap-editor": "^0.4.55", "@aws-sdk/client-s3": "^3.190.0", "@aws-sdk/s3-request-presigner": "^3.190.0", + "@dev-plugins/async-storage": "^0.0.3", + "@dev-plugins/react-navigation": "^0.0.6", + "@dev-plugins/react-query": "^0.0.6", "@google-cloud/recaptcha-enterprise-react-native": "^18.3.0", "@gorhom/bottom-sheet": "^4.5.1", "@op-engineering/op-sqlite": "5.0.5", diff --git a/apps/tlon-mobile/src/App.main.tsx b/apps/tlon-mobile/src/App.main.tsx index f8e45a4751..b90fce327a 100644 --- a/apps/tlon-mobile/src/App.main.tsx +++ b/apps/tlon-mobile/src/App.main.tsx @@ -1,10 +1,16 @@ +import { useAsyncStorageDevTools } from '@dev-plugins/async-storage'; +import { useReactNavigationDevTools } from '@dev-plugins/react-navigation'; +import { useReactQueryDevTools } from '@dev-plugins/react-query'; import NetInfo from '@react-native-community/netinfo'; import { DarkTheme, DefaultTheme, NavigationContainer, + NavigationContainerRefWithCurrent, + useNavigationContainerRef, } from '@react-navigation/native'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; +import { QueryClientProvider, queryClient } from '@tloncorp/shared/dist/api'; import { TamaguiProvider } from '@tloncorp/ui'; import { PostHogProvider } from 'posthog-react-native'; import type { PropsWithChildren } from 'react'; @@ -197,6 +203,7 @@ function MigrationCheck({ children }: PropsWithChildren) { export default function ConnectedApp(props: Props) { const isDarkMode = useIsDarkMode(); const tailwind = useTailwind(); + const navigationContainerRef = useNavigationContainerRef(); return ( - + - + + + + {__DEV__ && ( + + )} + @@ -221,3 +239,16 @@ export default function ConnectedApp(props: Props) { ); } + +// This is rendered as a component because I didn't have any better ideas +// on calling these hooks conditionally. +const DevTools = ({ + navigationContainerRef, +}: { + navigationContainerRef: NavigationContainerRefWithCurrent; +}) => { + useAsyncStorageDevTools(); + useReactQueryDevTools(queryClient); + useReactNavigationDevTools(navigationContainerRef); + return null; +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cef4a21078..4bef7eab86 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -89,6 +89,15 @@ importers: '@aws-sdk/s3-request-presigner': specifier: ^3.190.0 version: 3.190.0 + '@dev-plugins/async-storage': + specifier: ^0.0.3 + version: 0.0.3(@react-native-async-storage/async-storage@1.21.0(react-native@0.73.4(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7))(encoding@0.1.13)(react@18.2.0)))(expo@50.0.6(@babel/core@7.23.7)(@react-native/babel-preset@0.73.21(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7)))(encoding@0.1.13)) + '@dev-plugins/react-navigation': + specifier: ^0.0.6 + version: 0.0.6(@react-navigation/core@6.4.10(react@18.2.0))(expo@50.0.6(@babel/core@7.23.7)(@react-native/babel-preset@0.73.21(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7)))(encoding@0.1.13))(react@18.2.0) + '@dev-plugins/react-query': + specifier: ^0.0.6 + version: 0.0.6(@tanstack/react-query@5.32.1(react@18.2.0))(expo@50.0.6(@babel/core@7.23.7)(@react-native/babel-preset@0.73.21(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7)))(encoding@0.1.13)) '@google-cloud/recaptcha-enterprise-react-native': specifier: ^18.3.0 version: 18.4.0(react-native@0.73.4(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7))(encoding@0.1.13)(react@18.2.0))(react@18.2.0) @@ -2271,6 +2280,24 @@ packages: resolution: {integrity: sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==} engines: {node: '>=6.9.0'} + '@dev-plugins/async-storage@0.0.3': + resolution: {integrity: sha512-aFpz2YN6puUs5LYZDy4MAgpYNhMUgSBkdVB0lTf/H7a1S3TWZ/YXuLDIc0HCwpAeR0fTwa9CobdZ6WMLviWwfA==} + peerDependencies: + '@react-native-async-storage/async-storage': ^1.0.0 + expo: '*' + + '@dev-plugins/react-navigation@0.0.6': + resolution: {integrity: sha512-DBuNhCyo0kqYPxZzirL4TZBemOGHBI1pxxF6LOU4WlsVaCK16PJvvtgoD2Tbd0xS64fdfaDyISrn16RbIncy5A==} + peerDependencies: + '@react-navigation/core': '*' + expo: '*' + + '@dev-plugins/react-query@0.0.6': + resolution: {integrity: sha512-vxddpeongPPTN3NeWRsNRxwpB+7KpL+3FUVU0PmrFpEbMsLd0zbDEM7uC7z7ZR9qFuqeIY3uvwuq3LoYHBLT4w==} + peerDependencies: + '@tanstack/react-query': '*' + expo: '*' + '@egjs/hammerjs@2.0.17': resolution: {integrity: sha512-XQsZgjm2EcVUiZQf11UBJQfmZeEmOW8DpI1gsFeln6w0ae0ii4dMQEQ0kjl6DspdWX1aGY1/loyXnP0JS06e/A==} engines: {node: '>=0.8.0'} @@ -3959,6 +3986,11 @@ packages: peerDependencies: react: '*' + '@react-navigation/devtools@6.0.26': + resolution: {integrity: sha512-jbIb+678wb75Z1OiA/zP2g7ZuAviL9IFFTiadEcGog713n7XTm5xRr6uiCPWohalUJOvt8e9B8A2wRGmgELjHw==} + peerDependencies: + react: '*' + '@react-navigation/elements@1.3.22': resolution: {integrity: sha512-HYKucs0TwQT8zMvgoZbJsY/3sZfzeP8Dk9IDv4agst3zlA7ReTx4+SROCG6VGC7JKqBCyQykHIwkSwxhapoc+Q==} peerDependencies: @@ -7522,8 +7554,8 @@ packages: resolution: {integrity: sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==} engines: {node: ^10.12.0 || >=12.0.0} - flatted@3.2.6: - resolution: {integrity: sha512-0sQoMh9s0BYsm+12Huy/rkKxVu4R1+r96YX5cG44rHV0pQ6iC3Q+mkoMFaGWObMFYQxCVT+ssG1ksneA2MI9KQ==} + flatted@3.3.1: + resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==} flow-enums-runtime@0.0.6: resolution: {integrity: sha512-3PYnM29RFXwvAN6Pc/scUfkI7RwhQ/xqyLUyPNlXUp9S40zI8nup9tUSrTLSVnWGBN38FNiGWbwZOB6uR4OGdw==} @@ -9385,6 +9417,7 @@ packages: osenv@0.1.5: resolution: {integrity: sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==} + deprecated: This package is no longer supported. outdent@0.8.0: resolution: {integrity: sha512-KiOAIsdpUTcAXuykya5fnVVT+/5uS0Q1mrkRHcF89tpieSmY33O/tmc54CqwA+bfhbtEfZUNLHaPUiB9X3jt1A==} @@ -10542,18 +10575,22 @@ packages: rimraf@2.4.5: resolution: {integrity: sha512-J5xnxTyqaiw06JjMftq7L9ouA448dw/E7dKghkP9WpKNuwmARNNg+Gk8/u5ryb9N/Yo2+z3MCwuqFK/+qPOPfQ==} + deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true rimraf@2.6.3: resolution: {integrity: sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==} + deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true rimraf@2.7.1: resolution: {integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==} + deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true rimraf@3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} + deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true rollup-plugin-analyzer@4.0.0: @@ -13966,6 +14003,26 @@ snapshots: '@babel/helper-validator-identifier': 7.22.20 to-fast-properties: 2.0.0 + '@dev-plugins/async-storage@0.0.3(@react-native-async-storage/async-storage@1.21.0(react-native@0.73.4(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7))(encoding@0.1.13)(react@18.2.0)))(expo@50.0.6(@babel/core@7.23.7)(@react-native/babel-preset@0.73.21(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7)))(encoding@0.1.13))': + dependencies: + '@react-native-async-storage/async-storage': 1.21.0(react-native@0.73.4(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7))(encoding@0.1.13)(react@18.2.0)) + expo: 50.0.6(@babel/core@7.23.7)(@react-native/babel-preset@0.73.21(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7)))(encoding@0.1.13) + + '@dev-plugins/react-navigation@0.0.6(@react-navigation/core@6.4.10(react@18.2.0))(expo@50.0.6(@babel/core@7.23.7)(@react-native/babel-preset@0.73.21(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7)))(encoding@0.1.13))(react@18.2.0)': + dependencies: + '@react-navigation/core': 6.4.10(react@18.2.0) + '@react-navigation/devtools': 6.0.26(react@18.2.0) + expo: 50.0.6(@babel/core@7.23.7)(@react-native/babel-preset@0.73.21(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7)))(encoding@0.1.13) + nanoid: 3.3.7 + transitivePeerDependencies: + - react + + '@dev-plugins/react-query@0.0.6(@tanstack/react-query@5.32.1(react@18.2.0))(expo@50.0.6(@babel/core@7.23.7)(@react-native/babel-preset@0.73.21(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7)))(encoding@0.1.13))': + dependencies: + '@tanstack/react-query': 5.32.1(react@18.2.0) + expo: 50.0.6(@babel/core@7.23.7)(@react-native/babel-preset@0.73.21(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7)))(encoding@0.1.13) + flatted: 3.3.1 + '@egjs/hammerjs@2.0.17': dependencies: '@types/hammerjs': 2.0.45 @@ -16224,6 +16281,13 @@ snapshots: react-is: 16.13.1 use-latest-callback: 0.1.9(react@18.2.0) + '@react-navigation/devtools@6.0.26(react@18.2.0)': + dependencies: + deep-equal: 2.2.2 + nanoid: 3.3.7 + react: 18.2.0 + stacktrace-parser: 0.1.10 + '@react-navigation/elements@1.3.22(@react-navigation/native@6.1.10(react-native@0.73.4(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7))(encoding@0.1.13)(react@18.2.0))(react@18.2.0))(react-native-safe-area-context@4.8.2(react-native@0.73.4(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7))(encoding@0.1.13)(react@18.2.0))(react@18.2.0))(react-native@0.73.4(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7))(encoding@0.1.13)(react@18.2.0))(react@18.2.0)': dependencies: '@react-navigation/native': 6.1.10(react-native@0.73.4(@babel/core@7.23.7)(@babel/preset-env@7.23.7(@babel/core@7.23.7))(encoding@0.1.13)(react@18.2.0))(react@18.2.0) @@ -19710,24 +19774,24 @@ snapshots: deep-equal@2.2.2: dependencies: - array-buffer-byte-length: 1.0.0 - call-bind: 1.0.5 + array-buffer-byte-length: 1.0.1 + call-bind: 1.0.7 es-get-iterator: 1.1.3 - get-intrinsic: 1.2.2 + get-intrinsic: 1.2.4 is-arguments: 1.1.1 - is-array-buffer: 3.0.2 + is-array-buffer: 3.0.4 is-date-object: 1.0.5 is-regex: 1.1.4 - is-shared-array-buffer: 1.0.2 + is-shared-array-buffer: 1.0.3 isarray: 2.0.5 object-is: 1.1.5 object-keys: 1.1.1 - object.assign: 4.1.4 - regexp.prototype.flags: 1.5.1 + object.assign: 4.1.5 + regexp.prototype.flags: 1.5.2 side-channel: 1.0.4 which-boxed-primitive: 1.0.2 which-collection: 1.0.1 - which-typed-array: 1.1.13 + which-typed-array: 1.1.15 deep-extend@0.6.0: {} @@ -20105,8 +20169,8 @@ snapshots: es-get-iterator@1.1.3: dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 + call-bind: 1.0.7 + get-intrinsic: 1.2.4 has-symbols: 1.0.3 is-arguments: 1.1.1 is-map: 2.0.2 @@ -20969,10 +21033,10 @@ snapshots: flat-cache@3.0.4: dependencies: - flatted: 3.2.6 + flatted: 3.3.1 rimraf: 3.0.2 - flatted@3.2.6: {} + flatted@3.3.1: {} flow-enums-runtime@0.0.6: {} @@ -21581,7 +21645,7 @@ snapshots: is-arguments@1.1.1: dependencies: - call-bind: 1.0.5 + call-bind: 1.0.7 has-tostringtag: 1.0.0 is-array-buffer@3.0.2: @@ -21601,7 +21665,7 @@ snapshots: is-async-function@2.0.0: dependencies: - has-tostringtag: 1.0.0 + has-tostringtag: 1.0.2 is-bigint@1.0.4: dependencies: @@ -21613,8 +21677,8 @@ snapshots: is-boolean-object@1.1.2: dependencies: - call-bind: 1.0.5 - has-tostringtag: 1.0.0 + call-bind: 1.0.7 + has-tostringtag: 1.0.2 is-buffer@1.1.6: {} @@ -21630,7 +21694,7 @@ snapshots: is-date-object@1.0.5: dependencies: - has-tostringtag: 1.0.0 + has-tostringtag: 1.0.2 is-decimal@2.0.1: {} @@ -21705,7 +21769,7 @@ snapshots: is-number-object@1.0.7: dependencies: - has-tostringtag: 1.0.0 + has-tostringtag: 1.0.2 is-number@7.0.0: {} @@ -21733,8 +21797,8 @@ snapshots: is-regex@1.1.4: dependencies: - call-bind: 1.0.5 - has-tostringtag: 1.0.0 + call-bind: 1.0.7 + has-tostringtag: 1.0.2 is-regexp@1.0.0: {} @@ -21784,8 +21848,8 @@ snapshots: is-weakset@2.0.2: dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 + call-bind: 1.0.7 + get-intrinsic: 1.2.4 is-what@4.1.15: {} @@ -24840,7 +24904,7 @@ snapshots: stop-iteration-iterator@1.0.0: dependencies: - internal-slot: 1.0.5 + internal-slot: 1.0.7 stream-buffers@2.2.0: {} @@ -25992,7 +26056,7 @@ snapshots: isarray: 2.0.5 which-boxed-primitive: 1.0.2 which-collection: 1.0.1 - which-typed-array: 1.1.13 + which-typed-array: 1.1.15 which-collection@1.0.1: dependencies: