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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sample-app crash because of viewport changes #2313

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/SampleApp/src/components/BottomSheetOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Animated, {
withSpring,
withTiming,
} from 'react-native-reanimated';
import { KeyboardCompatibleView, useTheme, vh } from 'stream-chat-react-native';
import { KeyboardCompatibleView, useTheme, useViewport } from 'stream-chat-react-native';

import { AddMemberBottomSheet } from './AddMemberBottomSheet';
import { ConfirmationBottomSheet } from './ConfirmationBottomSheet';
Expand All @@ -44,12 +44,12 @@ export type BottomSheetOverlayProps = {
visible: boolean;
};

const screenHeight = vh(100);

export const BottomSheetOverlay = (props: BottomSheetOverlayProps) => {
const { overlayOpacity, visible } = props;

const { overlay, setOverlay } = useAppOverlayContext();
const { vh } = useViewport();
const screenHeight = vh(100);

const { reset } = useBottomSheetOverlayContext();

Expand Down
12 changes: 6 additions & 6 deletions examples/SampleApp/src/components/ChannelInfoOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ import {
User,
UserMinus,
useTheme,
vh,
vw,
useViewport,
} from 'stream-chat-react-native';

import { useAppOverlayContext } from '../context/AppOverlayContext';
Expand Down Expand Up @@ -94,10 +93,6 @@ const styles = StyleSheet.create({
},
});

const screenHeight = vh(100);
const halfScreenHeight = vh(50);
const width = vw(100) - 60;

export type ChannelInfoOverlayProps = {
overlayOpacity: Animated.SharedValue<number>;
visible?: boolean;
Expand All @@ -109,6 +104,11 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
const { overlay, setOverlay } = useAppOverlayContext();
const { setData } = useBottomSheetOverlayContext();
const { data, reset } = useChannelInfoOverlayContext();
const { vh, vw } = useViewport();

const screenHeight = vh(100);
const halfScreenHeight = vh(50);
const width = vw(100) - 60;

const { channel, clientId, navigation } = data || {};

Expand Down
9 changes: 5 additions & 4 deletions examples/SampleApp/src/components/UserInfoOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
User,
UserMinus,
useTheme,
vh,
useViewport,
} from 'stream-chat-react-native';

import { useAppOverlayContext } from '../context/AppOverlayContext';
Expand Down Expand Up @@ -96,9 +96,6 @@ const styles = StyleSheet.create({
},
});

const screenHeight = vh(100);
const halfScreenHeight = vh(50);

export type UserInfoOverlayProps = {
overlayOpacity: Animated.SharedValue<number>;
visible?: boolean;
Expand All @@ -111,6 +108,10 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
const { client } = useChatContext<StreamChatGenerics>();
const { setData } = useBottomSheetOverlayContext();
const { data, reset } = useUserInfoOverlayContext();
const { vh } = useViewport();

const screenHeight = vh(100);
const halfScreenHeight = vh(50);

const { channel, member, navigation } = data || {};

Expand Down
1 change: 1 addition & 0 deletions package/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './useAppStateListener';
export * from './useStreami18n';
export * from './useViewport';
Loading