Skip to content

Commit bd3d9ce

Browse files
committed
Use full screen design for the modal
1 parent da19c5d commit bd3d9ce

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

src/App.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import React, { useEffect, useState } from 'react';
2-
import { View } from 'react-native';
2+
import { SafeAreaView } from 'react-native';
33
import Modal from 'react-native-modal';
44
import PropTypes from 'prop-types';
55
import { storeHelper } from './utils';
66
import WebView from './WebView';
77
import styles from './style';
8+
import { COLOR_WHITE } from './constants';
9+
810
const propTypes = {
911
isModalVisible: PropTypes.bool.isRequired,
1012
websiteToken: PropTypes.string.isRequired,
@@ -48,12 +50,15 @@ const ChatWootWidget = ({
4850

4951
return (
5052
<Modal
51-
style={styles.modal}
53+
backdropColor={COLOR_WHITE}
5254
coverScreen
5355
isVisible={isModalVisible}
56+
onBackButtonPress={closeModal}
5457
onBackdropPress={closeModal}
55-
onBackButtonPress={closeModal}>
56-
<View style={styles.mainView}>
58+
style={styles.modal}
59+
>
60+
<SafeAreaView style={styles.headerView} />
61+
<SafeAreaView style={styles.mainView}>
5762
<WebView
5863
websiteToken={websiteToken}
5964
cwCookie={cwCookie}
@@ -63,7 +68,7 @@ const ChatWootWidget = ({
6368
customAttributes={customAttributes}
6469
closeModal={closeModal}
6570
/>
66-
</View>
71+
</SafeAreaView>
6772
</Modal>
6873
);
6974
};

src/WebView.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ const styles = StyleSheet.create({
8585
borderRadius: 4,
8686
overflow: 'hidden',
8787
},
88+
webViewContainer: {
89+
flex: 1,
90+
}
8891
});
8992
WebViewComponent.defaultProps = defaultProps;
9093
WebViewComponent.propTypes = propTypes;

src/constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ export const POST_MESSAGE_EVENTS = {
44
SET_CUSTOM_ATTRIBUTES: 'set-custom-attributes',
55
SET_USER: 'set-user',
66
};
7+
export const BG_COLOR = '#f1f5f8';
8+
export const COLOR_WHITE = '#fff';

src/style.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1+
import { BG_COLOR, COLOR_WHITE } from './constants';
2+
13
const { StyleSheet } = require('react-native');
24

35
const styles = StyleSheet.create({
46
modal: {
5-
paddingVertical: 16,
7+
flex: 1,
8+
margin: 0,
9+
paddingVertical: 0,
610
},
711
mainView: {
812
flex: 1,
9-
borderRadius: 16,
13+
backgroundColor: BG_COLOR,
1014
},
15+
headerView: {
16+
backgroundColor: COLOR_WHITE,
17+
flex: 0,
18+
}
1119
});
1220
export default styles;

0 commit comments

Comments
 (0)