Skip to content

Commit ec5f10e

Browse files
authored
chore: Remove default props (#45)
1 parent 85d18f0 commit ec5f10e

File tree

8 files changed

+6665
-3146
lines changed

8 files changed

+6665
-3146
lines changed

Example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"web": "expo start --web"
1010
},
1111
"dependencies": {
12-
"@chatwoot/react-native-widget": "^0.0.19",
12+
"@chatwoot/react-native-widget": "^0.0.20",
1313
"@react-native-async-storage/async-storage": "1.23.1",
1414
"expo": "~51.0.28",
1515
"expo-status-bar": "~1.12.1",

Example/src/App.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
55
import { storeHelper, findColors } from './utils';
66
import WebView from './WebView';
77
import styles from './style';
8-
import {COLOR_WHITE} from './constants';
8+
import { COLOR_WHITE } from './constants';
99

1010
const propTypes = {
1111
isModalVisible: PropTypes.bool.isRequired,
@@ -24,22 +24,14 @@ const propTypes = {
2424
closeModal: PropTypes.func,
2525
};
2626

27-
const defaultProps = {
28-
cwCookie: '',
29-
user: {},
30-
locale: 'en',
31-
colorScheme: 'light',
32-
customAttributes: {},
33-
};
34-
3527
const ChatWootWidget = ({
3628
isModalVisible,
3729
baseUrl,
3830
websiteToken,
39-
user,
40-
locale,
41-
colorScheme,
42-
customAttributes,
31+
user = {},
32+
locale = 'en',
33+
colorScheme = 'light',
34+
customAttributes = {},
4335
closeModal,
4436
}) => {
4537
const [cwCookie, setCookie] = useState('');
@@ -82,7 +74,6 @@ const ChatWootWidget = ({
8274
);
8375
};
8476

85-
ChatWootWidget.defaultProps = defaultProps;
8677
ChatWootWidget.propTypes = propTypes;
8778

8879
export default ChatWootWidget;

Example/src/WebView.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ const propTypes = {
1919
closeModal: PropTypes.func,
2020
};
2121

22-
const defaultProps = {
23-
cwCookie: '',
24-
user: {},
25-
locale: 'en',
26-
customAttributes: {},
27-
colorScheme: 'light',
28-
};
29-
3022
const WebViewComponent = ({
3123
baseUrl,
3224
websiteToken,
@@ -113,6 +105,6 @@ const styles = StyleSheet.create({
113105
flex: 1,
114106
},
115107
});
116-
WebViewComponent.defaultProps = defaultProps;
108+
117109
WebViewComponent.propTypes = propTypes;
118110
export default WebViewComponent;

example/yarn.lock

Lines changed: 6627 additions & 0 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.19",
3+
"version": "0.0.20",
44
"description": "React Native widget for Chatwoot",
55
"main": "index.js",
66
"scripts": {

src/App.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
55
import { storeHelper, findColors } from './utils';
66
import WebView from './WebView';
77
import styles from './style';
8-
import {COLOR_WHITE} from './constants';
8+
import { COLOR_WHITE } from './constants';
99

1010
const propTypes = {
1111
isModalVisible: PropTypes.bool.isRequired,
@@ -24,22 +24,14 @@ const propTypes = {
2424
closeModal: PropTypes.func,
2525
};
2626

27-
const defaultProps = {
28-
cwCookie: '',
29-
user: {},
30-
locale: 'en',
31-
colorScheme: 'light',
32-
customAttributes: {},
33-
};
34-
3527
const ChatWootWidget = ({
3628
isModalVisible,
3729
baseUrl,
3830
websiteToken,
39-
user,
40-
locale,
41-
colorScheme,
42-
customAttributes,
31+
user = {},
32+
locale = 'en',
33+
colorScheme = 'light',
34+
customAttributes = {},
4335
closeModal,
4436
}) => {
4537
const [cwCookie, setCookie] = useState('');
@@ -82,7 +74,6 @@ const ChatWootWidget = ({
8274
);
8375
};
8476

85-
ChatWootWidget.defaultProps = defaultProps;
8677
ChatWootWidget.propTypes = propTypes;
8778

8879
export default ChatWootWidget;

src/WebView.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,14 @@ const propTypes = {
1919
closeModal: PropTypes.func,
2020
};
2121

22-
const defaultProps = {
23-
cwCookie: '',
24-
user: {},
25-
locale: 'en',
26-
customAttributes: {},
27-
colorScheme: 'light',
28-
};
29-
3022
const WebViewComponent = ({
3123
baseUrl,
3224
websiteToken,
33-
cwCookie,
34-
locale,
35-
colorScheme,
36-
user,
37-
customAttributes,
25+
cwCookie = '',
26+
locale = 'en',
27+
colorScheme = 'light',
28+
user = {},
29+
customAttributes = {},
3830
closeModal,
3931
}) => {
4032
const [currentUrl, setCurrentUrl] = React.useState(null);
@@ -113,6 +105,5 @@ const styles = StyleSheet.create({
113105
flex: 1,
114106
},
115107
});
116-
WebViewComponent.defaultProps = defaultProps;
117108
WebViewComponent.propTypes = propTypes;
118109
export default WebViewComponent;

0 commit comments

Comments
 (0)