Skip to content

Instantly share code, notes, and snippets.

@watanabeyu
Last active October 1, 2018 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save watanabeyu/2481cbea906b8f502b0afab6e8956b3c to your computer and use it in GitHub Desktop.
Save watanabeyu/2481cbea906b8f502b0afab6e8956b3c to your computer and use it in GitHub Desktop.
import React from 'react';
import { BottomTabBar } from 'react-navigation-tabs';
const TabBar = (props) => {
const { navigation = {} } = props;
const { state = {} } = navigation;
let newProps = props;
if (state.index === 0) {
newProps = Object.assign(
{},
props,
{
style: {
backgroundColor:"#000",
},
activeTintColor: '#fff',
inactiveTintColor: '#bbb',
},
);
}
return <BottomTabBar {...newProps} />;
}
export default createBottomTabNavigator(
RouteConfigs,
{
tabBarComponent: TabBar,
tabBarPosition: 'bottom',
animationEnabled: false,
swipeEnabled: false,
},
);
let nightMode = false;
(async () => {
const dbCount = await new Promise(resolve => db.count({}).exec((error, docs) => {
if (error) {
return resolve(error);
}
return resolve(docs);
}));
console.log(dbCount)
const response = await new Promise(resolve => db.findOne({}).exec((error, docs) => {
if (error) {
return resolve(error);
}
return resolve(docs);
}));
...
nightMode = true
})();
export const TabBar = (props) => {
...
let newProps = props;
if(nightMode){
newProps = ...
}
return ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment