Last active
October 1, 2018 06:15
-
-
Save watanabeyu/2481cbea906b8f502b0afab6e8956b3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | |
}, | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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