Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit 3f5fe7f

Browse files
committed
move previewScreen component to previewScreen folder, remove using Toast notification use instead simple alert
1 parent d51103b commit 3f5fe7f

File tree

2 files changed

+20
-24
lines changed

2 files changed

+20
-24
lines changed

example/hooks/useToggleCamera.ts

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
import { useCallback } from 'react';
2-
import { Platform } from 'react-native';
3-
import * as Device from 'expo-device';
4-
import Toast from 'react-native-toast-message';
2+
53
import {
64
updateVideoTrackMetadata,
75
useCamera,
86
} from '@fishjam-dev/react-native-client';
7+
import {
8+
displayIosSimulatorCameraAlert,
9+
isIosSimulator,
10+
} from '../utils/deviceUtils';
911

1012
export function useToggleCamera() {
11-
const isIosEmulator = Platform.OS === 'ios' && !Device.isDevice;
1213
const { isCameraOn, toggleCamera: membraneToggleCamera } = useCamera();
1314

1415
const toggleCamera = useCallback(async () => {
15-
if (isIosEmulator) {
16-
Toast.show({
17-
type: 'info',
18-
text1: 'Camera is not supported on the iOS emulator',
19-
text2: 'Please run the app on a real device to use the camera',
20-
});
21-
16+
if (isIosSimulator) {
17+
displayIosSimulatorCameraAlert();
2218
return;
2319
}
2420

example/screens/PreviewScreen.tsx example/screens/PreviewScreen/index.tsx

+13-13
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ import {
1616
View,
1717
} from 'react-native';
1818

19-
import { InCallButton } from '../components';
20-
import LetterButton from '../components/LetterButton';
21-
import { NoCameraView } from '../components/NoCameraView';
22-
import { SoundOutputDevicesBottomSheet } from '../components/SoundOutputDevicesBottomSheet';
23-
import VideoPreview from '../components/VideoPreview';
24-
import type { AppRootStackParamList } from '../navigators/AppNavigator';
25-
import { previewScreenLabels } from '../types/ComponentLabels';
26-
import { BrandColors } from '../utils/Colors';
27-
import { usePreventBackButton } from '../hooks/usePreventBackButton';
19+
import { InCallButton } from '../../components';
20+
import LetterButton from '../../components/LetterButton';
21+
import { NoCameraView } from '../../components/NoCameraView';
22+
import { SoundOutputDevicesBottomSheet } from '../../components/SoundOutputDevicesBottomSheet';
23+
import VideoPreview from '../../components/VideoPreview';
24+
import type { AppRootStackParamList } from '../../navigators/AppNavigator';
25+
import { previewScreenLabels } from '../../types/ComponentLabels';
26+
import { BrandColors } from '../../utils/Colors';
27+
import { usePreventBackButton } from '../../hooks/usePreventBackButton';
2828
import {
2929
displayIosSimulatorCameraAlert,
3030
isIosSimulator,
31-
} from '../utils/deviceUtils';
32-
import { SwitchOutputDeviceButton } from './PreviewScreen/SwitchOutputDeviceButton';
33-
import { SwitchCameraButton } from './PreviewScreen/SwitchCameraButton';
34-
import { ToggleCameraButton } from './PreviewScreen/ToggleCameraButton';
31+
} from '../../utils/deviceUtils';
32+
import { SwitchOutputDeviceButton } from './SwitchOutputDeviceButton';
33+
import { SwitchCameraButton } from './SwitchCameraButton';
34+
import { ToggleCameraButton } from './ToggleCameraButton';
3535

3636
type Props = NativeStackScreenProps<AppRootStackParamList, 'Preview'>;
3737
const { JOIN_BUTTON, TOGGLE_MICROPHONE_BUTTON } = previewScreenLabels;

0 commit comments

Comments
 (0)