Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
);
}
}
class HighContrastExample extends React.Component {
state = {
isHighContrast: AppTheme.isHighContrast,
highContrastColorValues: AppTheme.currentHighContrastColors,
currentTheme: AppTheme.currentTheme,
};
componentDidMount() {
AppTheme.addListener('highContrastChanged', this.onHighContrastChanged);
AppTheme.addListener('appThemeChanged', this.onAppThemeChanged);
}
componenetWillUnmount() {
AppTheme.removeListener('highContrastChanged', this.onHighContrastChanged);
AppTheme.removeListener('appThemeChanged', this.onAppThemeChanged);
}
// TODO: Make args props
onHighContrastChanged = (event: IHighContrastChangedEvent) => {
this.setState({
isHighContrast: event.isHighContrast,
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
* @format
*/
import React = require('react');
import {Text, View, Button} from 'react-native';
import {AppTheme, IAppThemeChangedEvent} from 'react-native-windows';
class ThemeExample extends React.Component {
state = {
currentTheme: AppTheme.currentTheme,
};
componentDidMount() {
AppTheme.addListener('appThemeChanged', this.onAppThemeChanged);
}
componentWillUnmount() {
AppTheme.removeListener('appThemeChanged', this.onAppThemeChanged);
}
onAppThemeChanged = (event: IAppThemeChangedEvent) => {
const currentTheme = event.currentTheme;
this.setState({currentTheme});
};
_onPress = () => {};