From bc9352dc3b8dc06a5e3e562929979a6c06baf321 Mon Sep 17 00:00:00 2001 From: shanejonas Date: Wed, 5 Jun 2019 13:35:24 -0700 Subject: [PATCH] fix: dark and light mode on react json view --- src/App.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index afefcd06..7056ca7d 100755 --- a/src/App.tsx +++ b/src/App.tsx @@ -39,6 +39,7 @@ export default class App extends React.Component<{}, IState> { notification: {} as ISnackBarNotification, parsedSchema: {} as OpenRPC, reactJsonOptions: { + theme: "summerfruit:inverted", collapseStringsAfterLength: 25, displayDataTypes: false, displayObjectSize: false, @@ -114,12 +115,18 @@ export default class App extends React.Component<{}, IState> { public handleUrlChange = (event: any) => this.debouncedHandleUrlChange(event.target.value); public handleUISchemaAppBarChange = (name: string) => (value: any) => { + let reactJsonOptions = this.state.reactJsonOptions; if (name === "ui:darkMode") { monaco.editor.setTheme(value ? "vs-dark" : "vs"); - } + reactJsonOptions = { + ...this.state.reactJsonOptions, + theme: value ? "summerfruit" : "summerfruit:inverted", + }; + }; this.setState({ ...this.state, + reactJsonOptions, uiSchema: { ...this.state.uiSchema, appBar: {