-
Notifications
You must be signed in to change notification settings - Fork 184
SEL-187: Make bottom layout scrollable on smaller screens #525
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
Changes from all commits
9f30dae
8b952e5
63b42f9
37f84f5
7581b85
aba4da0
0923334
3fd9e1d
33948c8
8a6be7b
5f71ec7
aeab539
80bbe6c
3994fae
ab566f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| import { SENTRY_DSN } from '@env'; | ||
| import * as Sentry from '@sentry/react-native'; | ||
|
|
||
| export const isSentryDisabled = !SENTRY_DSN; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. simplify sentry check |
||
|
|
||
| export const initSentry = () => { | ||
| if (!SENTRY_DSN) { | ||
| if (isSentryDisabled) { | ||
| return null; | ||
| } | ||
|
|
||
|
|
@@ -32,7 +34,7 @@ export const captureException = ( | |
| error: Error, | ||
| context?: Record<string, any>, | ||
| ) => { | ||
| if (!SENTRY_DSN) { | ||
| if (isSentryDisabled) { | ||
| return; | ||
| } | ||
| Sentry.captureException(error, { | ||
|
|
@@ -44,7 +46,7 @@ export const captureMessage = ( | |
| message: string, | ||
| context?: Record<string, any>, | ||
| ) => { | ||
| if (!SENTRY_DSN) { | ||
| if (isSentryDisabled) { | ||
| return; | ||
| } | ||
| Sentry.captureMessage(message, { | ||
|
|
@@ -53,5 +55,5 @@ export const captureMessage = ( | |
| }; | ||
|
|
||
| export const wrapWithSentry = (App: React.ComponentType) => { | ||
| return SENTRY_DSN ? Sentry.wrap(App) : App; | ||
| return isSentryDisabled ? App : Sentry.wrap(App); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import { IS_TEST_BUILD } from '@env'; | ||
|
|
||
| export const shouldShowAesopRedesign = (): boolean => { | ||
| return IS_TEST_BUILD === 'true'; | ||
| return JSON.parse(IS_TEST_BUILD); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix new design trigger |
||
| }; | ||
|
|
||
| export const useAesopRedesign = (): boolean => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,8 @@ import { useNetInfo } from '@react-native-community/netinfo'; | |
| import { useEffect } from 'react'; | ||
| import { Linking, Platform } from 'react-native'; | ||
|
|
||
| import { useModal } from '../hooks/useModal'; | ||
| import { navigationRef } from '../Navigation'; | ||
| import { useModal } from './useModal'; | ||
|
|
||
| const connectionModalParams = { | ||
| titleText: 'Internet connection error', | ||
|
|
@@ -21,20 +21,20 @@ const connectionModalParams = { | |
| } as const; | ||
|
|
||
| export default function useConnectionModal() { | ||
| const { isInternetReachable } = useNetInfo(); | ||
| const { isConnected } = useNetInfo(); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| const { showModal, dismissModal, visible } = useModal(connectionModalParams); | ||
|
|
||
| useEffect(() => { | ||
| if (!navigationRef.isReady()) { | ||
| return; | ||
| } | ||
|
|
||
| if (isInternetReachable === false && !visible) { | ||
| if (isConnected === false && !visible) { | ||
| showModal(); | ||
| } else if (visible && isInternetReachable !== false) { | ||
| } else if (visible && isConnected !== false) { | ||
| dismissModal(); | ||
| } | ||
| }, [isInternetReachable, dismissModal, visible, navigationRef.isReady()]); | ||
| }, [isConnected, dismissModal, visible, navigationRef.isReady()]); | ||
|
|
||
| return { | ||
| visible, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,21 @@ | ||
| import React from 'react'; | ||
| import { StatusBar, StyleSheet } from 'react-native'; | ||
| import { | ||
| Dimensions, | ||
| PixelRatio, | ||
| ScrollView, | ||
| StatusBar, | ||
| StyleSheet, | ||
| } from 'react-native'; | ||
| import { useSafeAreaInsets } from 'react-native-safe-area-context'; | ||
| import { View, ViewProps } from 'tamagui'; | ||
|
|
||
| import { black, white } from '../utils/colors'; | ||
|
|
||
| // Get the current font scale factor | ||
| const fontScale = PixelRatio.getFontScale(); | ||
| // fontScale > 1 means the user has increased text size in accessibility settings | ||
| const isLargerTextEnabled = fontScale > 1; | ||
|
|
||
| interface ExpandableBottomLayoutProps extends ViewProps { | ||
| children: React.ReactNode; | ||
| backgroundColor: string; | ||
|
|
@@ -90,12 +101,29 @@ const BottomSection: React.FC<BottomSectionProps> = ({ | |
| const { bottom: safeAreaBottom } = useSafeAreaInsets(); | ||
| const incomingBottom = props.paddingBottom ?? props.pb ?? 0; | ||
| const minBottom = Math.max(safeAreaBottom, 10); | ||
|
|
||
| const totalBottom = | ||
| typeof incomingBottom === 'number' ? minBottom + incomingBottom : minBottom; | ||
|
|
||
| let panelHeight: number | 'auto' = 'auto'; | ||
| // set bottom section height to 38% of screen height | ||
| // and wrap children in a scroll view if larger text is enabled | ||
| if (isLargerTextEnabled) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is phone has large text enabled, set the bottom panel height and wrap the children within a |
||
| const windowHeight = Dimensions.get('window').height; | ||
| panelHeight = windowHeight * 0.38; | ||
| children = ( | ||
| <ScrollView | ||
| showsVerticalScrollIndicator={false} | ||
| contentContainerStyle={{ flexGrow: 1 }} | ||
| > | ||
| {children} | ||
| </ScrollView> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <View | ||
| {...props} | ||
| height={panelHeight} | ||
| style={[styles.bottomSection, style]} | ||
| paddingBottom={totalBottom} | ||
| > | ||
|
|
||
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.
fyi @remicolin fixes android package install issue