diff options
Diffstat (limited to 'app/services/reactotron')
-rw-r--r-- | app/services/reactotron/index.ts | 2 | ||||
-rw-r--r-- | app/services/reactotron/reactotron-config.ts | 2 | ||||
-rw-r--r-- | app/services/reactotron/reactotron.ts | 61 | ||||
-rw-r--r-- | app/services/reactotron/tron.ts | 2 | ||||
-rw-r--r-- | app/services/reactotron/tron.web.ts | 2 |
5 files changed, 38 insertions, 31 deletions
diff --git a/app/services/reactotron/index.ts b/app/services/reactotron/index.ts index 60a8b40..0c02f1f 100644 --- a/app/services/reactotron/index.ts +++ b/app/services/reactotron/index.ts @@ -1 +1 @@ -export * from "./reactotron" +export * from './reactotron' diff --git a/app/services/reactotron/reactotron-config.ts b/app/services/reactotron/reactotron-config.ts index dd87bd7..40e9c93 100644 --- a/app/services/reactotron/reactotron-config.ts +++ b/app/services/reactotron/reactotron-config.ts @@ -21,7 +21,7 @@ export interface ReactotronConfig { */ export const DEFAULT_REACTOTRON_CONFIG: ReactotronConfig = { clearOnLoad: true, - host: "localhost", + host: 'localhost', useAsyncStorage: true, state: { initial: true, diff --git a/app/services/reactotron/reactotron.ts b/app/services/reactotron/reactotron.ts index 0ec12ad..eda9ed9 100644 --- a/app/services/reactotron/reactotron.ts +++ b/app/services/reactotron/reactotron.ts @@ -1,12 +1,15 @@ -import { Tron } from "./tron" -import AsyncStorage from "@react-native-async-storage/async-storage" -import { RootStore } from "../../models/root-store/root-store" -import { onSnapshot } from "mobx-state-tree" -import { ReactotronConfig, DEFAULT_REACTOTRON_CONFIG } from "./reactotron-config" -import { mst } from "reactotron-mst" -import { clear } from "../../utils/storage" -import { RootNavigation } from "../../navigators" -import { Platform } from "react-native" +import { Tron } from './tron' +import AsyncStorage from '@react-native-async-storage/async-storage' +import { RootStore } from '../../models/root-store/root-store' +import { onSnapshot } from 'mobx-state-tree' +import { + ReactotronConfig, + DEFAULT_REACTOTRON_CONFIG, +} from './reactotron-config' +import { mst } from 'reactotron-mst' +import { clear } from '../../utils/storage' +import { RootNavigation } from '../../navigators' +import { Platform } from 'react-native' // Teach TypeScript about the bad things we want to do. declare global { @@ -67,7 +70,7 @@ export class Reactotron { constructor(config: ReactotronConfig = DEFAULT_REACTOTRON_CONFIG) { // merge the passed in config with some defaults this.config = { - host: "localhost", + host: 'localhost', useAsyncStorage: true, ...config, state: { @@ -89,16 +92,20 @@ export class Reactotron { this.rootStore = rootStore const { initial, snapshots } = this.config.state - const name = "ROOT STORE" + const name = 'ROOT STORE' // logging features if (initial) { - console.tron.display({ name, value: initialData, preview: "Initial State" }) + console.tron.display({ + name, + value: initialData, + preview: 'Initial State', + }) } // log state changes? if (snapshots) { onSnapshot(rootStore, (snapshot) => { - console.tron.display({ name, value: snapshot, preview: "New State" }) + console.tron.display({ name, value: snapshot, preview: 'New State' }) }) } @@ -114,12 +121,12 @@ export class Reactotron { if (__DEV__) { // configure reactotron Tron.configure({ - name: this.config.name || require("../../../package.json").name, + name: this.config.name || require('../../../package.json').name, host: this.config.host, }) // hookup middleware - if (Platform.OS !== "web") { + if (Platform.OS !== 'web') { if (this.config.useAsyncStorage) { Tron.setAsyncStorageHandler(AsyncStorage) } @@ -143,31 +150,31 @@ export class Reactotron { // Register Custom Commands Tron.onCustomCommand({ - title: "Reset Root Store", - description: "Resets the MST store", - command: "resetStore", + title: 'Reset Root Store', + description: 'Resets the MST store', + command: 'resetStore', handler: () => { - console.tron.log("resetting store") + console.tron.log('resetting store') clear() }, }) Tron.onCustomCommand({ - title: "Reset Navigation State", - description: "Resets the navigation state", - command: "resetNavigation", + title: 'Reset Navigation State', + description: 'Resets the navigation state', + command: 'resetNavigation', handler: () => { - console.tron.log("resetting navigation state") + console.tron.log('resetting navigation state') RootNavigation.resetRoot({ routes: [] }) }, }) Tron.onCustomCommand({ - title: "Go Back", - description: "Goes back", - command: "goBack", + title: 'Go Back', + description: 'Goes back', + command: 'goBack', handler: () => { - console.tron.log("Going back") + console.tron.log('Going back') RootNavigation.goBack() }, }) diff --git a/app/services/reactotron/tron.ts b/app/services/reactotron/tron.ts index f6c872d..6086e48 100644 --- a/app/services/reactotron/tron.ts +++ b/app/services/reactotron/tron.ts @@ -1,2 +1,2 @@ -import Reactotron from "reactotron-react-native" +import Reactotron from 'reactotron-react-native' export const Tron = Reactotron diff --git a/app/services/reactotron/tron.web.ts b/app/services/reactotron/tron.web.ts index bcee53b..a525c06 100644 --- a/app/services/reactotron/tron.web.ts +++ b/app/services/reactotron/tron.web.ts @@ -1,2 +1,2 @@ -import Reactotron from "reactotron-react-js" +import Reactotron from 'reactotron-react-js' export const Tron = Reactotron |