Skip to content

Commit

Permalink
chore: Remove default props (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
muhsin-k authored Sep 27, 2024
1 parent 85d18f0 commit ec5f10e
Show file tree
Hide file tree
Showing 8 changed files with 6,665 additions and 3,146 deletions.
2 changes: 1 addition & 1 deletion Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"web": "expo start --web"
},
"dependencies": {
"@chatwoot/react-native-widget": "^0.0.19",
"@chatwoot/react-native-widget": "^0.0.20",
"@react-native-async-storage/async-storage": "1.23.1",
"expo": "~51.0.28",
"expo-status-bar": "~1.12.1",
Expand Down
19 changes: 5 additions & 14 deletions Example/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
import { storeHelper, findColors } from './utils';
import WebView from './WebView';
import styles from './style';
import {COLOR_WHITE} from './constants';
import { COLOR_WHITE } from './constants';

const propTypes = {
isModalVisible: PropTypes.bool.isRequired,
Expand All @@ -24,22 +24,14 @@ const propTypes = {
closeModal: PropTypes.func,
};

const defaultProps = {
cwCookie: '',
user: {},
locale: 'en',
colorScheme: 'light',
customAttributes: {},
};

const ChatWootWidget = ({
isModalVisible,
baseUrl,
websiteToken,
user,
locale,
colorScheme,
customAttributes,
user = {},
locale = 'en',
colorScheme = 'light',
customAttributes = {},
closeModal,
}) => {
const [cwCookie, setCookie] = useState('');
Expand Down Expand Up @@ -82,7 +74,6 @@ const ChatWootWidget = ({
);
};

ChatWootWidget.defaultProps = defaultProps;
ChatWootWidget.propTypes = propTypes;

export default ChatWootWidget;
10 changes: 1 addition & 9 deletions Example/src/WebView.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ const propTypes = {
closeModal: PropTypes.func,
};

const defaultProps = {
cwCookie: '',
user: {},
locale: 'en',
customAttributes: {},
colorScheme: 'light',
};

const WebViewComponent = ({
baseUrl,
websiteToken,
Expand Down Expand Up @@ -113,6 +105,6 @@ const styles = StyleSheet.create({
flex: 1,
},
});
WebViewComponent.defaultProps = defaultProps;

WebViewComponent.propTypes = propTypes;
export default WebViewComponent;
6,627 changes: 6,627 additions & 0 deletions example/yarn.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chatwoot/react-native-widget",
"version": "0.0.19",
"version": "0.0.20",
"description": "React Native widget for Chatwoot",
"main": "index.js",
"scripts": {
Expand Down
19 changes: 5 additions & 14 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
import { storeHelper, findColors } from './utils';
import WebView from './WebView';
import styles from './style';
import {COLOR_WHITE} from './constants';
import { COLOR_WHITE } from './constants';

const propTypes = {
isModalVisible: PropTypes.bool.isRequired,
Expand All @@ -24,22 +24,14 @@ const propTypes = {
closeModal: PropTypes.func,
};

const defaultProps = {
cwCookie: '',
user: {},
locale: 'en',
colorScheme: 'light',
customAttributes: {},
};

const ChatWootWidget = ({
isModalVisible,
baseUrl,
websiteToken,
user,
locale,
colorScheme,
customAttributes,
user = {},
locale = 'en',
colorScheme = 'light',
customAttributes = {},
closeModal,
}) => {
const [cwCookie, setCookie] = useState('');
Expand Down Expand Up @@ -82,7 +74,6 @@ const ChatWootWidget = ({
);
};

ChatWootWidget.defaultProps = defaultProps;
ChatWootWidget.propTypes = propTypes;

export default ChatWootWidget;
19 changes: 5 additions & 14 deletions src/WebView.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,14 @@ const propTypes = {
closeModal: PropTypes.func,
};

const defaultProps = {
cwCookie: '',
user: {},
locale: 'en',
customAttributes: {},
colorScheme: 'light',
};

const WebViewComponent = ({
baseUrl,
websiteToken,
cwCookie,
locale,
colorScheme,
user,
customAttributes,
cwCookie = '',
locale = 'en',
colorScheme = 'light',
user = {},
customAttributes = {},
closeModal,
}) => {
const [currentUrl, setCurrentUrl] = React.useState(null);
Expand Down Expand Up @@ -113,6 +105,5 @@ const styles = StyleSheet.create({
flex: 1,
},
});
WebViewComponent.defaultProps = defaultProps;
WebViewComponent.propTypes = propTypes;
export default WebViewComponent;
Loading

0 comments on commit ec5f10e

Please sign in to comment.