Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Commit

Permalink
feat(reactotron): Update to the latest reactotron and switch how cust…
Browse files Browse the repository at this point in the history
…om commands are done (#182)

[skip ci]
  • Loading branch information
rmevans9 authored and jamonholmgren committed May 5, 2019
1 parent 3de95d8 commit ea1d736
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 29 deletions.
24 changes: 0 additions & 24 deletions boilerplate/app/services/reactotron/command-middleware.ts

This file was deleted.

25 changes: 22 additions & 3 deletions boilerplate/app/services/reactotron/reactotron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ 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 { commandMiddleware } from "./command-middleware"

// Teach TypeScript about the bad things we want to do.
Expand Down Expand Up @@ -126,12 +127,30 @@ export class Reactotron {
}),
)

// hookup custom command middleware
Tron.use(commandMiddleware(() => this.rootStore))

// connect to the app
Tron.connect()

// Register Custom Commands
Tron.onCustomCommand({
title: 'Reset Root Store',
description: 'Resets the MST store',
command: 'resetStore',
handler: () => {
console.tron.log("resetting store")
clear()
},
})

Tron.onCustomCommand({
title: 'Reset Navigation Store',
description: 'Resets the navigation store',
command: 'resetNavigation',
handler: () => {
console.tron.log("resetting navigation store")
this.rootStore.navigationStore.reset()
}
})

// clear if we should
if (this.config.clearOnLoad) {
Tron.clear()
Expand Down
4 changes: 2 additions & 2 deletions boilerplate/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"react-native-keychain": "3.0.0",
"react-native-splash-screen": "3.1.1",
"react-navigation": "3.0.0",
"reactotron-mst": "^2.1.0",
"reactotron-react-native": "^2.1.0",
"reactotron-mst": "^3.1.1",
"reactotron-react-native": "^3.4.1",
"validate.js": "0.12.0"
},
"devDependencies": {
Expand Down

0 comments on commit ea1d736

Please sign in to comment.