mirror of
https://github.com/zhigang1992/react-native-paper.git
synced 2026-06-12 09:08:12 +08:00
* refactor: Add DarkTheme, new colors in theme & update components to use it * chore: Remove 'console.log' statements * chore: Change dark theme property from string to boolean * feat: Add ability to toggle the theme from the drawer * fix: Wrap typography example screen with 'withTheme' * style: Update components to use correct dark theme colors * style: Update dark theme primary color and rn-navigation toolbar now gets the color from the theme * style: Add color prop to DrawerItem and update the example * style: Change the unchecked color in both Checkbox and RadioButton * chore: Add `yarn-error.log` to `.gitignore` * chore: Use lodash instead of lodash.merge * chore: Address PR comments
51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
/* @flow */
|
|
|
|
import Expo from 'expo';
|
|
import React, { Component } from 'react';
|
|
import { StatusBar } from 'react-native';
|
|
import {
|
|
Provider as PaperProvider,
|
|
DarkTheme,
|
|
DefaultTheme,
|
|
} from 'react-native-paper';
|
|
import { DrawerNavigator } from 'react-navigation';
|
|
import RootNavigator from './src/RootNavigator';
|
|
import DrawerItems from './DrawerItems';
|
|
|
|
StatusBar.setBarStyle('light-content');
|
|
|
|
const App = DrawerNavigator(
|
|
{ Home: { screen: RootNavigator } },
|
|
{
|
|
contentComponent: ({ screenProps }) => (
|
|
<DrawerItems toggleTheme={screenProps.toggleTheme} />
|
|
),
|
|
}
|
|
);
|
|
|
|
class PaperExample extends Component {
|
|
state = {
|
|
theme: DarkTheme,
|
|
};
|
|
|
|
_toggleTheme = () =>
|
|
this.setState({
|
|
theme: this.state.theme === DarkTheme ? DefaultTheme : DarkTheme,
|
|
});
|
|
|
|
render() {
|
|
return (
|
|
<PaperProvider theme={this.state.theme}>
|
|
<App
|
|
screenProps={{
|
|
toggleTheme: this._toggleTheme,
|
|
theme: this.state.theme,
|
|
}}
|
|
/>
|
|
</PaperProvider>
|
|
);
|
|
}
|
|
}
|
|
|
|
Expo.registerRootComponent(PaperExample);
|