From 988ebccb65ad59d15df2e239decf9d1ae6df9068 Mon Sep 17 00:00:00 2001
From: ryanml <rlanese@asu.edu>
Date: Fri, 24 Apr 2020 12:34:29 -0700
Subject: [PATCH] Fixes brave/brave-browser#9414 - Implements crypto widget
 toggle logic in componentDidUpdate

---
 .../brave_new_tab_ui/containers/newTab/index.tsx   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/components/brave_new_tab_ui/containers/newTab/index.tsx b/components/brave_new_tab_ui/containers/newTab/index.tsx
index cccd12f1c2f8..9e3cabb3fd3d 100644
--- a/components/brave_new_tab_ui/containers/newTab/index.tsx
+++ b/components/brave_new_tab_ui/containers/newTab/index.tsx
@@ -129,6 +129,20 @@ class NewTabPage extends React.Component<Props, State> {
       this.stopWaitingForBrandedWallpaperNotificationAutoDismiss()
     }
 
+    // Handles updates from brave://settings/newTab
+    const oldShowRewards = prevProps.newTabData.showRewards
+    const oldShowBinance = prevProps.newTabData.showBinance
+    const { showRewards, showBinance } = this.props.newTabData
+
+    if (!oldShowRewards && showRewards) {
+      this.props.actions.setCurrentStackWidget('rewards')
+    } else if (!oldShowBinance && showBinance) {
+      this.props.actions.setCurrentStackWidget('binance')
+    } else if (oldShowRewards && !showRewards) {
+      this.props.actions.setCurrentStackWidget('binance')
+    } else if (oldShowBinance && !showBinance) {
+      this.props.actions.setCurrentStackWidget('rewards')
+    }
   }
 
   trackCachedImage () {