22import * as React from 'react' ;
33import { Platform , NativeModules } from 'react-native' ;
44import { WebView } from 'react-native-webview' ;
5- import { getColorScheme } from 'react-native/Libraries/Utilities/Appearance' ;
65
76import { connectActionSheet } from '../react-native-action-sheet' ;
87import type {
@@ -17,6 +16,8 @@ import type {
1716 EditMessage ,
1817} from '../types' ;
1918import { assumeSecretlyGlobalState } from '../reduxTypes' ;
19+ import type { ThemeData } from '../styles' ;
20+ import { ThemeContext } from '../styles' ;
2021import { connect } from '../react-redux' ;
2122import {
2223 getCurrentTypingUsers ,
@@ -38,7 +39,6 @@ import { caseNarrow, isConversationNarrow } from '../utils/narrow';
3839import { type BackgroundData , getBackgroundData } from './backgroundData' ;
3940import { ensureUnreachable } from '../generics' ;
4041import { renderSinglePageWebView } from './SinglePageWebView' ;
41- import { getThemeToUse } from '../settings/settingsSelectors' ;
4242
4343type OuterProps = $ReadOnly < { |
4444 narrow : Narrow ,
@@ -125,6 +125,9 @@ const webviewAssetsUrl = new URL('webview/', assetsUrl);
125125const baseUrl = new URL ( 'index.html' , webviewAssetsUrl ) ;
126126
127127class MessageListInner extends React . Component < Props > {
128+ static contextType = ThemeContext ;
129+ context : ThemeData ;
130+
128131 webviewRef = React . createRef < React$ElementRef < typeof WebView >> ( ) ;
129132 sendInboundEventsIsReady : boolean ;
130133 unsentInboundEvents : WebViewInboundEvent [ ] = [ ] ;
@@ -178,12 +181,10 @@ class MessageListInner extends React.Component<Props> {
178181 const contentHtml = messageListElementsForShownMessages
179182 . map ( element => messageListElementHtml ( { backgroundData, element, _ } ) )
180183 . join ( '' ) ;
181- const { auth , theme } = backgroundData ;
182- const osScheme = getColorScheme ( ) ;
183- const themeToUse = getThemeToUse ( theme , osScheme ) ;
184+ const { auth } = backgroundData ;
184185 const html : string = getHtml (
185186 contentHtml ,
186- themeToUse ,
187+ this . context . themeName ,
187188 {
188189 scrollMessageId : initialScrollMessageId ,
189190 auth,
0 commit comments