Skip to content
This repository was archived by the owner on Dec 6, 2023. It is now read-only.

Commit ea49e3e

Browse files
committed
feat: Allow commands to flow back to the client
1 parent 14bff7e commit ea49e3e

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"dependencies": {
4141
"mitt": "1.1.3",
4242
"query-string": "6.8.3",
43-
"reactotron-core-client": "2.8.7",
43+
"reactotron-core-client": "2.8.8",
4444
"rn-host-detect": "1.1.5"
4545
},
4646
"devDependencies": {

src/connection-manager.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NativeModules } from "react-native"
1+
import { NativeEventEmitter, NativeModules } from "react-native"
22

33
export default class ConnectionManager {
44
private webSocket: any
@@ -34,6 +34,14 @@ export default class ConnectionManager {
3434
}
3535
} else if (event === "message") {
3636
this.webSocket.onmessage = evt => callback(evt.data)
37+
38+
if (this.flipperConnection) {
39+
const flipperConnectionEmitter = new NativeEventEmitter(NativeModules.Reactotron)
40+
41+
flipperConnectionEmitter.addListener("CommandReceived", command => {
42+
callback(command)
43+
})
44+
}
3745
}
3846
}
3947

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9253,10 +9253,10 @@ react@16.9.0:
92539253
object-assign "^4.1.1"
92549254
prop-types "^15.6.2"
92559255

9256-
reactotron-core-client@2.8.7:
9257-
version "2.8.7"
9258-
resolved "https://registry.yarnpkg.com/reactotron-core-client/-/reactotron-core-client-2.8.7.tgz#9bcbda3b8446c75a9cc2f16fcad583de9aeac7d1"
9259-
integrity sha512-2yJYIUqaI+5jf8pscBelY9stcTYke6tDSofUq8L8zuQMQWknsgGr94ZZzo6vz/M5o7vUxb+DnQVs9msWxZJqMg==
9256+
reactotron-core-client@2.8.8:
9257+
version "2.8.8"
9258+
resolved "https://registry.yarnpkg.com/reactotron-core-client/-/reactotron-core-client-2.8.8.tgz#fa1f93629e9a3d1b2beca765701b8ef3a8c3d3c0"
9259+
integrity sha512-FCXudNw5zCcV6waXCubGGxypVS2EKZMRwJ89rd6GCsgFENbJhGizcPyjmv6aBatHFIQcLhUD7XShZJEqWs7E4A==
92609260

92619261
read-cmd-shim@^1.0.1:
92629262
version "1.0.1"

0 commit comments

Comments
 (0)