Skip to content

Commit 2bd056d

Browse files
authored
Merge pull request #39 from RonasIT/PRD-2132-keyboard-controllers-refactoring
PRD-2132: ScreenWrapper keyboard avoidance fix
2 parents fc6d16c + 67d8026 commit 2bd056d

4 files changed

Lines changed: 11 additions & 6 deletions

File tree

apps/mobile/app/(main)/chat/create.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default function CreateChatScreen(): ReactElement {
4747
header: <AppHeader title={translate('TEXT_NEW_CHAT')} onGoBack={handleBackPress} />,
4848
}}
4949
safeAreaProps={{ edges: [] }}
50-
keyBoardAvoidingProps={{ enabled: !isBottomSheetInputFocused }}>
50+
keyBoardAvoidingProps={{ enabled: !isBottomSheetInputFocused, bottomOffset: 60 }}>
5151
<NoConnectionBanner isVisible={isOfflineMode} />
5252
<CreateChat
5353
onChatCreated={handleChatCreated}

libs/mobile/shared/ui/keyboard-avoiding-view/src/lib/component.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
import { ComponentType } from 'react';
22
import { ScrollViewProps, StyleProp, ViewStyle } from 'react-native';
33
import { KeyboardAwareScrollView } from 'react-native-keyboard-controller';
4-
import { commonStyle } from '@open-webui-react-native/mobile/shared/ui/styles';
54

65
export type AppKeyboardAvoidingViewProps = Omit<ScrollViewProps, 'onFocus'> & {
76
onFocus?: ((event: any) => void) | null;
87
contentContainerStyleKeyboardShown?: StyleProp<ViewStyle>;
98
enabled?: boolean;
9+
bottomOffset?: number;
1010
};
1111

1212
// TODO: Research how use nativewind here
1313
export const AppKeyboardAvoidingView: ComponentType<AppKeyboardAvoidingViewProps> = ({ children, ...props }) => {
14-
const { onFocus, ...restProps } = props;
14+
const { onFocus, contentContainerStyle, bottomOffset, ...restProps } = props;
1515

1616
return (
1717
<KeyboardAwareScrollView
1818
keyboardShouldPersistTaps='handled'
1919
showsVerticalScrollIndicator={false}
20-
contentContainerStyle={commonStyle.fullFlex}
20+
contentContainerStyle={[{ flexGrow: 1 }, contentContainerStyle]}
21+
bottomOffset={bottomOffset}
2122
onFocus={onFocus ?? undefined}
2223
{...restProps}>
2324
{children}

libs/mobile/shared/ui/screen-wrapper/src/lib/component.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ export function ScreenWrapper({
2626
keyBoardAvoidingProps,
2727
}: PropsWithChildren<ScreenWrapperProps>): ReactElement {
2828
const { header, ...restScreenProps } = screenProps || {};
29+
2930
const content = isKeyboardAvoiding ? (
3031
<AppKeyboardAvoidingView {...keyBoardAvoidingProps}>
31-
<AppScreen {...restScreenProps}>{children}</AppScreen>
32+
<AppScreen scrollDisabled {...restScreenProps}>
33+
{children}
34+
</AppScreen>
3235
</AppKeyboardAvoidingView>
3336
) : (
3437
<AppScreen {...restScreenProps}>{children}</AppScreen>

libs/shared/data-access/api/src/lib/knowledge/models/knowledge-response.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { Expose } from 'class-transformer';
1+
import { Expose, Type } from 'class-transformer';
22
import { Knowledge } from './knowledge';
33

44
export class KnowledgeResponse {
55
@Expose()
6+
@Type(() => Knowledge)
67
public items: Array<Knowledge>;
78

89
@Expose()

0 commit comments

Comments
 (0)