From 0ab53505afe4bfc84dc9761537e9dd5b8c34b4e9 Mon Sep 17 00:00:00 2001 From: Miguel Alatzar Date: Sun, 3 Nov 2019 12:04:05 -0700 Subject: [PATCH] Ensure setNavigatorStyles is called with Channel componentId (#3515) --- app/screens/channel/channel_base.js | 2 ++ app/screens/channel/channel_base.test.js | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/screens/channel/channel_base.js b/app/screens/channel/channel_base.js index 65a0ae1d0..eb41aa3c4 100644 --- a/app/screens/channel/channel_base.js +++ b/app/screens/channel/channel_base.js @@ -108,6 +108,8 @@ export default class ChannelBase extends PureComponent { componentWillReceiveProps(nextProps) { if (this.props.theme !== nextProps.theme) { + setNavigatorStyles(this.props.componentId, nextProps.theme); + EphemeralStore.allNavigationComponentIds.forEach((componentId) => { setNavigatorStyles(componentId, nextProps.theme); }); diff --git a/app/screens/channel/channel_base.test.js b/app/screens/channel/channel_base.test.js index 7dc29d405..975bcb907 100644 --- a/app/screens/channel/channel_base.test.js +++ b/app/screens/channel/channel_base.test.js @@ -14,6 +14,7 @@ import ChannelBase from './channel_base'; jest.mock('react-intl'); describe('ChannelBase', () => { + const channelBaseComponentId = 'component-0'; const componentIds = ['component-1', 'component-2', 'component-3']; const baseProps = { actions: { @@ -24,7 +25,7 @@ describe('ChannelBase', () => { recordLoadTime: jest.fn(), getChannelStats: jest.fn(), }, - componentId: componentIds[0], + componentId: channelBaseComponentId, theme: Preferences.THEMES.default, }; const optionsForTheme = (theme) => { @@ -61,7 +62,7 @@ describe('ChannelBase', () => { const themeOptions = optionsForTheme(Preferences.THEMES.default); expect(mergeNavigationOptions.mock.calls).toEqual([ - [componentIds[0], themeOptions], + [baseProps.componentId, themeOptions], ]); mergeNavigationOptions.mockClear(); @@ -69,6 +70,7 @@ describe('ChannelBase', () => { const newThemeOptions = optionsForTheme(Preferences.THEMES.mattermostDark); expect(mergeNavigationOptions.mock.calls).toEqual([ + [baseProps.componentId, newThemeOptions], [componentIds[2], newThemeOptions], [componentIds[1], newThemeOptions], [componentIds[0], newThemeOptions],