1- import React , { useContext , useState } from 'react' ;
1+ import React , { useState } from 'react' ;
22import { StyleSheet , View , Image , Linking } from 'react-native' ;
33import { useNavigation } from '@react-navigation/native' ;
44import {
@@ -12,18 +12,23 @@ import {
1212 Divider ,
1313 Window ,
1414 Anchor ,
15+ useTheme ,
1516} from 'react95-native' ;
16-
17+ import type { Theme } from 'react95-native' ;
1718import examples from './examples' ;
1819import themes from './examples/themes' ;
19- import { LocalThemeContext } from './util/LocalThemeContext' ;
2020import ThemeButton from './util/ThemeButton' ;
2121
22- const ExamplesScreen = ( ) => {
22+ type Props = {
23+ setTheme : ( theme : Theme ) => void ;
24+ } ;
25+
26+ const ExamplesScreen = ( { setTheme : setThemeProp } : Props ) => {
2327 const [ showAboutModal , setShowAboutModal ] = useState ( false ) ;
2428 const navigation = useNavigation ( ) ;
25- const { theme : currentTheme , setTheme } = useContext ( LocalThemeContext ) ;
29+ // const { theme: currentTheme, setTheme } = useContext(LocalThemeContext);
2630
31+ const currentTheme = useTheme ( ) ;
2732 const openLink = ( url : string ) => {
2833 Linking . openURL ( url ) . catch ( err => console . warn ( "Couldn't load page" , err ) ) ;
2934 } ;
@@ -150,7 +155,7 @@ const ExamplesScreen = () => {
150155 theme = { theme }
151156 currentTheme = { currentTheme }
152157 selected = { theme . name === currentTheme . name }
153- onPress = { ( ) => setTheme ( theme ) }
158+ onPress = { ( ) => setThemeProp ( theme ) }
154159 key = { theme . name }
155160 />
156161 ) ) }
0 commit comments