Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor SceneWrapper, header, and footer #4721

Merged
merged 22 commits into from
Jan 18, 2024
Merged

Refactor SceneWrapper, header, and footer #4721

merged 22 commits into from
Jan 18, 2024

Conversation

samholmes
Copy link
Contributor

@samholmes samholmes commented Jan 17, 2024

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

Copy link
Contributor

@swansontec swansontec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks super-good for such a huge PR. There are only minor issues.

src/components/common/SceneWrapper.tsx Outdated Show resolved Hide resolved
src/components/scenes/CryptoExchangeQuoteScene.tsx Outdated Show resolved Hide resolved
onPress={() => navigation.navigate('walletsTab', { screen: 'walletList' })}
alignSelf="center"
/>
<View style={styles.bottomButton}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rant: This is what Jon has been harping on - we should be using the ButtonsView to put a button on a scene in a particular layout, instead of centering it ourselves.

However, I see that this is a special case, since we are floating the button at the bottom of the screen. Since we are in a hurry, there is no need to go adding a special mode to the ButtonsView! Arguably this could even go in the scene footer area, but again, no need to do that in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. Good to know.

I also was inclined to revisit this and other scenes with floating components to instead render these components int he footer.

Comment on lines 18 to 25
return <BlurView blurType={theme.isDark ? 'dark' : 'light'} style={styles.blurView} overlayColor={overlayColor} />
}

const getStyles = cacheStyles(() => ({
blurView: {
...StyleSheet.absoluteFillObject,
backgroundColor: isAndroid ? '#00000055' : undefined
}
}))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all wrong. By default, the BlurView looks consistent on both iOS and Android. However, Android lets you manually adjust the tint color using the overlayColor, so we ourselves started making Android look different. But now we don't like the inconsistency, so we tweak it back a different way!!!

What about just deleting the overlayColor prop and letting things automatically be the same on both platforms? This will also deal with the light-mode, which your current solution doesn't address.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overlayColor applied on the whole screen on Android. That was the reason for the transparent value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, interesting. So it's a bug-fix to the blur library!? In that case, we should document it as such.

src/components/scenes/CoinRankingScene.tsx Show resolved Hide resolved
The `insetStyles` should simply be a convenient set of padding styles
derived from the `insets` without modification to the values.
Instead of long summations of terms with separate conditions inline, we
factor out each term and its respective condition to make the logic
easy to reason about and maintain.
A style is a set of rules. It was a mistake to name this property in
the plural form.
We can use `avoidKeyboard` prop directly to know if we are in this mode
in the `SceneWrapper`.
Some scenes don't register the scroll handler and therefore don't have
local scroll state to stomp on the global scroll state. In this case,
they'll be left with another scene's scroll state.

To fix this, we set the scroll state back to its default scroll state
when the scene is no longer in focus.

We also fix a bug where local state never stomps on scrollXDelta
and scrollYDelta.
Copy link
Contributor

@swansontec swansontec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blur changes look good. We could mention that the colors are hard-coded to match the iOS colors on Android, so the theme is irrelevant to that goal.

This change makes for a more straight forward API where the scene
component may always expect padding and scene wrapper size to be
applied consistently. The scene is responsible for applying negative
margins using `undoInsetStyle` if it wishes to overlap under UI
components (header/tabs/etc).
We add a black transparent background on Android to BlurBackground for
presentation consistency across platforms.
Before we were adding a minimum padding to the bottom of the MenuTabs.
This clearly caused bugs. The new approach is to just use the bottom
inset for the bottom padding in the MenuBar so that way the SceneFooter
can include it in position calculations.
We remove the overlayColor property from BlurBackground which is
Android-only. Instead, we add a backgroundColor to the blur view to
match the light/dark modes in iOS.
@samholmes samholmes merged commit ce9eb47 into develop Jan 18, 2024
2 checks passed
@samholmes samholmes deleted the sam/scene-footer branch January 18, 2024 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants