1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-15 09:04:04 +02:00
joplin/ReactNativeClient/lib/components/base-screen.js

40 lines
787 B
JavaScript
Raw Normal View History

2019-07-29 15:43:53 +02:00
const React = require('react');
2019-07-29 15:58:33 +02:00
const { StyleSheet } = require('react-native');
const { globalStyle, themeStyle } = require('lib/components/global-style.js');
2017-07-14 20:49:14 +02:00
2017-07-31 22:03:12 +02:00
const styleObject_ = {
2017-07-14 20:49:14 +02:00
screen: {
flex: 1,
2017-07-21 23:40:02 +02:00
backgroundColor: globalStyle.backgroundColor,
2017-07-14 20:49:14 +02:00
},
2017-07-31 22:03:12 +02:00
};
const styles_ = StyleSheet.create(styleObject_);
2017-07-14 20:49:14 +02:00
const rootStyles_ = {};
2017-08-01 19:59:01 +02:00
2017-07-14 20:49:14 +02:00
class BaseScreenComponent extends React.Component {
styles() {
return styles_;
}
2017-07-31 22:03:12 +02:00
styleObject() {
return styleObject_;
}
2017-08-01 19:59:01 +02:00
rootStyle(themeId) {
const theme = themeStyle(themeId);
if (rootStyles_[themeId]) return rootStyles_[themeId];
rootStyles_[themeId] = StyleSheet.create({
root: {
flex: 1,
backgroundColor: theme.backgroundColor,
},
});
return rootStyles_[themeId];
}
2017-07-14 20:49:14 +02:00
}
2019-07-29 15:43:53 +02:00
module.exports = { BaseScreenComponent };