@@ -6,19 +6,22 @@ import React from 'react';
66import { AppRegistry , StyleSheet , View , NativeModules } from 'react-native' ;
77import { Picker } from 'react-native-windows' ;
88import Colors from './Resources/Colors' ;
9- import Dictionary from './Resources/Dictionary' ;
9+ import * as dictionary from './Resources/Dictionary' ;
10+ import * as theming from './Resources/Theming/ThemeHOC' ;
1011
1112interface Properties { }
1213
1314interface State {
1415 selectedLanguage : number ;
16+ selectedTheme : number ;
1517}
1618
1719class SettingsPanel extends React . Component < Properties , State > {
1820 constructor ( props : Properties ) {
1921 super ( props ) ;
2022 this . state = {
2123 selectedLanguage : 0 ,
24+ selectedTheme : 0 ,
2225 } ;
2326 }
2427
@@ -27,13 +30,18 @@ class SettingsPanel extends React.Component<Properties, State> {
2730 this . setState ( { selectedLanguage : value } ) ;
2831 } ;
2932
33+ themeValueChanged = ( value : number ) => {
34+ NativeModules . Database . setThemeValue ( value ) ;
35+ this . setState ( { selectedTheme : value } ) ;
36+ } ;
37+
3038 render ( ) {
3139 return (
32- < View style = { styles . mainPanel } >
40+ < theming . ThemedView style = { styles . mainPanel } >
3341 < View style = { styles . languageField } >
34- < Dictionary
42+ < dictionary . Dictionary
3543 style = { styles . languageText }
36- textLabel = { 'settings.languageLabel' } > </ Dictionary >
44+ textLabel = { 'settings.languageLabel' } > </ dictionary . Dictionary >
3745 < Picker
3846 selectedValue = { this . state . selectedLanguage }
3947 style = { styles . languageSelectionBox }
@@ -42,7 +50,25 @@ class SettingsPanel extends React.Component<Properties, State> {
4250 < Picker . Item label = "Polski" value = { 1 } />
4351 </ Picker >
4452 </ View >
45- </ View >
53+ < View style = { styles . themeField } >
54+ < dictionary . Dictionary
55+ style = { styles . languageText }
56+ textLabel = { 'theme.theme' } > </ dictionary . Dictionary >
57+ < Picker
58+ selectedValue = { this . state . selectedTheme }
59+ style = { styles . themeSelectionBox }
60+ onValueChange = { this . themeValueChanged } >
61+ < Picker . Item
62+ label = { dictionary . getTextByKey ( 'theme.default' ) }
63+ value = { 0 }
64+ />
65+ < Picker . Item
66+ label = { dictionary . getTextByKey ( 'theme.dark' ) }
67+ value = { 1 }
68+ />
69+ </ Picker >
70+ </ View >
71+ </ theming . ThemedView >
4672 ) ;
4773 }
4874}
@@ -52,7 +78,6 @@ const styles = StyleSheet.create({
5278 flex : 1 ,
5379 flexDirection : 'column' ,
5480 alignItems : 'center' ,
55- margin : 30 ,
5681 } ,
5782 languageText : {
5883 fontWeight : 'bold' ,
@@ -66,10 +91,22 @@ const styles = StyleSheet.create({
6691 width : '50%' ,
6792 alignItems : 'center' ,
6893 } ,
94+ themeField : {
95+ flex : 1 ,
96+ flexDirection : 'row' ,
97+ justifyContent : 'space-around' ,
98+ margin : 20 ,
99+ width : '50%' ,
100+ alignItems : 'center' ,
101+ } ,
69102 languageSelectionBox : {
70103 height : 30 ,
71104 width : 150 ,
72105 } ,
106+ themeSelectionBox : {
107+ height : 30 ,
108+ width : 150 ,
109+ } ,
73110} ) ;
74111
75112AppRegistry . registerComponent ( 'SettingsPanel' , ( ) => SettingsPanel ) ;
0 commit comments