forked from Galaxies-dev/meetings-react-native-stream
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomBottomSheet.tsx
49 lines (44 loc) · 1.36 KB
/
CustomBottomSheet.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { StyleSheet, Text, KeyboardAvoidingView, Platform } from 'react-native';
import React, { forwardRef, useMemo } from 'react';
import BottomSheet, { BottomSheetView } from '@gorhom/bottom-sheet';
import ChatView from './ChatView';
import Colors from '../constants/Colors';
export type Ref = BottomSheet;
interface Props {
channelId: string;
}
// Custom Bottom Sheet to display the chat
const CustomBottomSheet = forwardRef<Ref, Props>((props, ref) => {
const snapPoints = useMemo(() => ['15%', '100%'], []);
return (
<BottomSheet
ref={ref}
index={0}
snapPoints={snapPoints}
handleIndicatorStyle={{ backgroundColor: Colors.primary }}
backgroundStyle={{ backgroundColor: '#fff' }}>
<BottomSheetView style={styles.contentContainer}>
<Text style={styles.containerHeadline}>Chat</Text>
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
keyboardVerticalOffset={120}
style={{ flex: 1 }}>
<ChatView channelId={props.channelId} />
</KeyboardAvoidingView>
</BottomSheetView>
</BottomSheet>
);
});
const styles = StyleSheet.create({
contentContainer: {
flex: 1,
paddingBottom: 20,
},
containerHeadline: {
fontSize: 24,
fontWeight: '600',
padding: 20,
textAlign: 'center',
},
});
export default CustomBottomSheet;