diff --git a/apps/mobile/.storybook/storybook.requires.ts b/apps/mobile/.storybook/storybook.requires.ts index fcaaf0d7b..0364019b3 100644 --- a/apps/mobile/.storybook/storybook.requires.ts +++ b/apps/mobile/.storybook/storybook.requires.ts @@ -13,12 +13,12 @@ const normalizedStories = [ directory: "./components", files: "**/*.stories.?(ts|tsx|js|jsx)", importPathMatcher: - /^\.(?:(?:^|[\\/]|(?:(?:(?!(?:^|[\\/])\.).)*?)[\\/])(?!\.)(?=.)[^\\/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/, + /^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/, // @ts-ignore req: require.context( "../components", true, - /^\.(?:(?:^|[\\/]|(?:(?:(?!(?:^|[\\/])\.).)*?)[\\/])(?!\.)(?=.)[^\\/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/ + /^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/ ), }, ]; diff --git a/apps/mobile/ReactotronConfig.js b/apps/mobile/ReactotronConfig.js new file mode 100644 index 000000000..92b6cda5b --- /dev/null +++ b/apps/mobile/ReactotronConfig.js @@ -0,0 +1,32 @@ +import reactotronZustand from 'reactotron-plugin-zustand' +import Reactotron, { + openInEditor, + trackGlobalErrors +} from 'reactotron-react-native' + +import { useAccountBuilderStore } from '@/store/accountBuilder' +import { useAccountStore } from '@/store/accounts' +import { useAuthStore } from '@/store/auth' +import { useSettingsStore } from '@/store/settings' +import { useTransactionBuilderStore } from '@/store/transactionBuilder' +import { useWalletsStore } from '@/store/wallets' + +Reactotron.configure() // controls connection & communication settings + .useReactNative() // add all built-in react native plugins + .use( + //add this line 🙌 + reactotronZustand({ + stores: [ + { name: 'auth', store: useAuthStore }, + { name: 'accountBuilder', store: useAccountBuilderStore }, + { name: 'settings', store: useSettingsStore }, + // { name: 'account', store: useAccountStore }, + { name: 'wallets', store: useWalletsStore }, + { name: 'transactions', store: useTransactionBuilderStore } + ], + omitFunctionKeys: false + }) + ) + .use(openInEditor()) + .use(trackGlobalErrors()) + .connect() // let's connect! diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx index 3a5e59b99..a0203ee22 100644 --- a/apps/mobile/app/_layout.tsx +++ b/apps/mobile/app/_layout.tsx @@ -21,6 +21,8 @@ import { import { useAuthStore } from '@/store/auth' import { Colors } from '@/styles' +require('../ReactotronConfig') + if (Platform.OS === 'android') { SystemUI.setBackgroundColorAsync(Colors.gray[950]) diff --git a/apps/mobile/index.js b/apps/mobile/index.js index be68b325e..6415ff318 100644 --- a/apps/mobile/index.js +++ b/apps/mobile/index.js @@ -2,4 +2,9 @@ import { registerRootComponent } from 'expo' import App from '@' +require('./ReactotronConfig') +// if (__DEV__) { +// require('./ReactotronConfig') +// } + registerRootComponent(App) diff --git a/apps/mobile/package.json b/apps/mobile/package.json index 7008ae362..66f7553c5 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -108,6 +108,8 @@ "jest": "^29.7.0", "jest-expo": "^50.0.4", "react-dom": "18.2.0", + "reactotron-plugin-zustand": "^2.0.8", + "reactotron-react-native": "^5.1.12", "rn-nodeify": "^10.3.0", "typescript": "^5.1.3" }, diff --git a/yarn.lock b/yarn.lock index 7dba40d40..9f856684d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5731,7 +5731,7 @@ deep-is@^0.1.3: resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== -deepmerge@^4.2.2, deepmerge@^4.3.0: +deepmerge@^4.2.2, deepmerge@^4.3.0, deepmerge@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== @@ -10374,6 +10374,11 @@ minizlib@^2.1.1: minipass "^3.0.0" yallist "^4.0.0" +mitt@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/mitt/-/mitt-3.0.1.tgz#ea36cf0cc30403601ae074c8f77b7092cdab36d1" + integrity sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw== + mkdirp@^0.5.1, mkdirp@~0.5.1: version "0.5.6" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" @@ -11713,6 +11718,33 @@ react@^18.3.1: dependencies: loose-envify "^1.1.0" +reactotron-core-client@2.9.7: + version "2.9.7" + resolved "https://registry.yarnpkg.com/reactotron-core-client/-/reactotron-core-client-2.9.7.tgz#c1fd2842b095dbd2c7522cfc6bd59e34768038eb" + integrity sha512-QWd0ekjU71CQL70J87NT5f7cmIJAMVZND+YgOaaUgmgFjhiXzHrpeIWs19+IFQPVLsJr97gdi58X8Y62Hchs9w== + dependencies: + reactotron-core-contract "0.2.5" + +reactotron-core-contract@0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/reactotron-core-contract/-/reactotron-core-contract-0.2.5.tgz#927160c026895798bfe931bd2462fdd5d4e435f9" + integrity sha512-pxuXFG1jffAWQSdT0FBws+/Xvl8++6T6WrAi4g7AxIZU5FPeut2wq//0yDhDWx6lF82eAo5JTZK7zECQy45QxA== + +reactotron-plugin-zustand@^2.0.8: + version "2.0.8" + resolved "https://registry.yarnpkg.com/reactotron-plugin-zustand/-/reactotron-plugin-zustand-2.0.8.tgz#47335c16bd6c9f9b19140ebccbe709f0cc03454a" + integrity sha512-GkioXdXdZIOCi1FHv3xAHAF4eN9GJkpKeNBY8y7Bm1CqjOQvn8x94jNrMsgOMLufm5utsQLUQt8RkPtnHC4UWA== + dependencies: + deepmerge "^4.3.1" + +reactotron-react-native@^5.1.12: + version "5.1.12" + resolved "https://registry.yarnpkg.com/reactotron-react-native/-/reactotron-react-native-5.1.12.tgz#fd4d6af812f8af02087ac74c3495688e7f0a8ac8" + integrity sha512-3MNdoqoOP0xc1e0jjoKWdKonI0ucgPSj36ETDxj9zFMC+CSFLybvABzHz3K5Mr1KbKln/Csh4mEqCq2XPIpqrg== + dependencies: + mitt "^3.0.1" + reactotron-core-client "2.9.7" + readable-stream@^3.4.0: version "3.6.2" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967"