Skip to content

Commit 89c6802

Browse files
authored
fix: Use full screen design for the modal
2 parents da19c5d + 14f96a8 commit 89c6802

File tree

8 files changed

+1780
-1741
lines changed

8 files changed

+1780
-1741
lines changed

examples/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ SPEC CHECKSUMS:
377377
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
378378
DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de
379379
FBLazyVector: 49cbe4b43e445b06bf29199b6ad2057649e4c8f5
380-
FBReactNativeSpec: f6af9bcec43fcc256bbcc3458fffc8e61c2d40e6
380+
FBReactNativeSpec: e1faac61254e41dcc6f397af15921c15cfc9911a
381381
glog: 73c2498ac6884b13ede40eda8228cb1eee9d9d62
382382
RCT-Folly: ec7a233ccc97cc556cf7237f0db1ff65b986f27c
383383
RCTRequired: 2f8cb5b7533219bf4218a045f92768129cf7050a
@@ -408,4 +408,4 @@ SPEC CHECKSUMS:
408408

409409
PODFILE CHECKSUM: 3f57f8f9a44ff9ba5fc829e5392025271d888429
410410

411-
COCOAPODS: 1.10.2
411+
COCOAPODS: 1.11.3

examples/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"lint": "eslint ."
1212
},
1313
"dependencies": {
14-
"@chatwoot/react-native-widget": "^0.0.3",
14+
"@chatwoot/react-native-widget": "../chatwoot-react-native-widget-0.0.7.tgz",
1515
"@react-native-async-storage/async-storage": "^1.14.1",
1616
"react": "17.0.1",
1717
"react-native": "0.64.0",

examples/yarn.lock

Lines changed: 1750 additions & 1729 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chatwoot/react-native-widget",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "React Native widget for Chatwoot",
55
"main": "index.js",
66
"scripts": {

src/App.js

Lines changed: 11 additions & 6 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,
@@ -25,7 +27,7 @@ const defaultProps = {
2527
cwCookie: '',
2628
user: {},
2729
locale: 'en',
28-
customattributes: {},
30+
customAttributes: {},
2931
};
3032

3133
const ChatWootWidget = ({
@@ -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)