-
Notifications
You must be signed in to change notification settings - Fork 118
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
Enable landscape orientation for android #64
Conversation
useEffect(() => { | ||
bottomSheetRef.current?.snapTo(isExpanded ? 0 : 1); | ||
}, [width, isExpanded]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't ideal - unfortunately without it when the bottom sheet is collapsed, on rotation it sometimes would disappear.
import {useOrientation} from './useOrientation'; | ||
import {Theme} from './theme'; | ||
|
||
export const useMaxContentWidth = (): number | undefined => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rationale for this hook is that if we later want to change how the maxWidth is determined (say, maybe percentage of viewport), we can just make the modification here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a lot better, there are some weird things still but this is worth getting in and iterating
Enable landscape orientation for android
Related to: #11
screenOrientation
in the manifest fromportrait
tounspecified
Dimensions
object have been changed to use theuseWindowDimensions
hook in order to be dynamicBottomSheet was tricky - when using percent snapPoints the
BottomSheetRaw
component doesn't seem to update its internal height/width values that it uses to evaluate the points based on percent when screen dimensions change (see this issue for related discussion: osdnk/react-native-reanimated-bottom-sheet#72).Tried getting around this by passing it a
key
that changed on rotation in order to force remount, but this had other issues that needed working around and offers poor UX. In the end opted for passing in dynamic values as snap points, based on current width/height of the viewport.Edit: Did not see the recent design updates here: #11 (comment). Feel free to close if this doesn't go deep enough.
Home:
Onboarding: