Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
plumb which background color to show during transitions on android (#…
  • Loading branch information
buoyad committed Oct 7, 2019
1 parent 04991b1 commit f7ae1e9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion shared/override-d.ts/react-navigation/index.d.ts
Expand Up @@ -423,7 +423,8 @@ declare module 'react-navigation' {
// Only works on stack navigator
// Future versions of react-navigation will use reanimated, so we can define
// the background color as an animated value. And remove this value.
bgOnlyDuringTransition?: boolean
// Return the color to show during transitions.
bgOnlyDuringTransition?: () => string
cardShadowEnabled?: boolean
cardOverlayEnabled?: boolean
cardStyle?: StyleProp<ViewStyle>
Expand Down
2 changes: 1 addition & 1 deletion shared/package.json
Expand Up @@ -174,7 +174,7 @@
"react-native-unimodules": "git://github.com/keybase/react-native-unimodules/#v0.4.0",
"react-native-video": "4.4.4",
"react-native-webview": "5.12.1",
"react-navigation-stack": "git://github.com/keybase/stack#marco/animated-background",
"react-navigation-stack": "git://github.com/keybase/stack#danny/marco-animated-background-plus-darkmode",
"react-navigation-tabs": "2.2.0",
"react-redux": "7.1.0",
"react-spring": "8.0.27",
Expand Down
7 changes: 5 additions & 2 deletions shared/router-v2/router.native.tsx
Expand Up @@ -114,10 +114,13 @@ const TabBarIconContainer = props => (
</Kb.NativeTouchableWithoutFeedback>
)

// globalColors automatically respects dark mode pref
const getBg = () => Styles.globalColors.white

const VanillaTabNavigator = createBottomTabNavigator(
tabs.reduce((map, tab) => {
map[tab] = createStackNavigator(Shim.shim(routes), {
bgOnlyDuringTransition: Styles.isAndroid,
bgOnlyDuringTransition: Styles.isAndroid ? getBg : undefined,
cardStyle: Styles.isAndroid ? {backgroundColor: 'rgba(0,0,0,0)'} : undefined,
defaultNavigationOptions,
headerMode,
Expand Down Expand Up @@ -198,7 +201,7 @@ const LoggedInStackNavigator = createStackNavigator(
...Shim.shim(modalRoutes),
},
{
bgOnlyDuringTransition: Styles.isAndroid,
bgOnlyDuringTransition: Styles.isAndroid ? getBg : undefined,
cardStyle: Styles.isAndroid ? {backgroundColor: 'rgba(0,0,0,0)'} : undefined,
headerMode: 'none',
mode: 'modal',
Expand Down
4 changes: 2 additions & 2 deletions shared/yarn.lock
Expand Up @@ -11122,9 +11122,9 @@ react-native@0.60.5:
stacktrace-parser "^0.1.3"
whatwg-fetch "^3.0.0"

"react-navigation-stack@git://github.com/keybase/stack#marco/animated-background":
"react-navigation-stack@git://github.com/keybase/stack#danny/marco-animated-background-plus-darkmode":
version "1.0.4"
resolved "git://github.com/keybase/stack#c9ef4142d89a47791537699027debefe279c1dc4"
resolved "git://github.com/keybase/stack#7e88988111a5c2cb184b0f74a3024a9b1c0106e5"

react-navigation-tabs@2.2.0:
version "2.2.0"
Expand Down

0 comments on commit f7ae1e9

Please sign in to comment.