Fixed side menu staying open when changing tab + fixed ios tab icon color

This commit is contained in:
keplyx 2019-09-16 19:13:01 +02:00
parent cecf4154f6
commit dd4ba0a9fc
5 changed files with 31 additions and 6 deletions

View file

@ -24,6 +24,8 @@ type State = {
export default class BaseContainer extends React.Component<Props, State> { export default class BaseContainer extends React.Component<Props, State> {
willBlurSubscription: function;
static defaultProps = { static defaultProps = {
headerRightButton: <View/> headerRightButton: <View/>
}; };
@ -43,6 +45,26 @@ export default class BaseContainer extends React.Component<Props, State> {
this.setState({isOpen}); this.setState({isOpen});
} }
/**
* Register for blur event to close side menu on screen change
*/
componentDidMount() {
this.willBlurSubscription = this.props.navigation.addListener(
'willBlur',
payload => {
this.setState({isOpen: false});
}
);
}
/**
* Unregister from event when un-mounting components
*/
componentWillUnmount() {
if (this.willBlurSubscription !== undefined)
this.willBlurSubscription.remove();
}
render() { render() {
return ( return (
<View style={{ <View style={{

View file

@ -121,7 +121,7 @@ export default class FetchedDataSectionList extends React.Component<Props, State
_onRefresh = () => { _onRefresh = () => {
let canRefresh; let canRefresh;
if (this.lastRefresh !== undefined) if (this.lastRefresh !== undefined)
canRefresh = (new Date().getTime() - this.lastRefresh.getTime())/1000 > this.minTimeBetweenRefresh; canRefresh = (new Date().getTime() - this.lastRefresh.getTime()) / 1000 > this.minTimeBetweenRefresh;
else else
canRefresh = true; canRefresh = true;
@ -314,9 +314,10 @@ export default class FetchedDataSectionList extends React.Component<Props, State
tabbedView.push( tabbedView.push(
<Tab heading={ <Tab heading={
<TabHeading> <TabHeading>
<CustomMaterialIcon icon={dataset[i].icon} <CustomMaterialIcon
color={'#fff'} icon={dataset[i].icon}
fontSize={20} color={ThemeManager.getCurrentThemeVariables().tabIconColor}
fontSize={20}
/> />
<Text>{dataset[i].title}</Text> <Text>{dataset[i].title}</Text>
</TabHeading>} </TabHeading>}

View file

@ -238,6 +238,7 @@ export default {
// Tabs // Tabs
tabBgColor: "#F8F8F8", tabBgColor: "#F8F8F8",
tabIconColor: platform === "ios" ? "#5d5d5d" : "#fff",
tabFontSize: 15, tabFontSize: 15,
// Text // Text

View file

@ -239,6 +239,7 @@ export default {
// Tabs // Tabs
tabBgColor: "#2b2b2b", tabBgColor: "#2b2b2b",
tabIconColor: "#fff",
tabFontSize: 15, tabFontSize: 15,
// Text // Text

View file

@ -36,7 +36,7 @@ export default class ProxiwashAboutScreen extends React.Component<Props> {
<TabHeading> <TabHeading>
<CustomMaterialIcon <CustomMaterialIcon
icon={'information'} icon={'information'}
color={'#fff'} color={ThemeManager.getCurrentThemeVariables().tabIconColor}
fontSize={20} fontSize={20}
/> />
<Text>{i18n.t('proxiwashScreen.informationTab')}</Text> <Text>{i18n.t('proxiwashScreen.informationTab')}</Text>
@ -106,7 +106,7 @@ export default class ProxiwashAboutScreen extends React.Component<Props> {
<TabHeading> <TabHeading>
<CustomMaterialIcon <CustomMaterialIcon
icon={'cash'} icon={'cash'}
color={'#fff'} color={ThemeManager.getCurrentThemeVariables().tabIconColor}
fontSize={20} fontSize={20}
/> />
<Text>{i18n.t('proxiwashScreen.paymentTab')}</Text> <Text>{i18n.t('proxiwashScreen.paymentTab')}</Text>