Skip to content

Commit cc6fc0c

Browse files
authored
feat: Add dark theme support
2 parents aef8999 + 41daf99 commit cc6fc0c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+4336
-7108
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2017-2021 Chatwoot Inc.
3+
Copyright (c) 2017-2023 Chatwoot Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ chatwoot-react-native-widget
77
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)
88
![](https://img.shields.io/npm/l/@chatwoot/@chatwoot/react-native-widget)
99

10-
- **Supported Chatwoot version:** 1.18.0+
10+
- **Supported Chatwoot version:** 2.16.0+
1111

1212
<img src="https://user-images.githubusercontent.com/12408980/203909820-938136a6-bf5b-433e-9f68-d7f28a1303be.png" alt="screenshot" width="350">
1313

@@ -61,6 +61,7 @@ const App = () => {
6161
const websiteToken = 'WEBSITE_TOKEN';
6262
const baseUrl = 'CHATWOOT_INSTALLATION_URL';
6363
const locale = 'en';
64+
const colorScheme='dark'
6465
6566
return (
6667
<SafeAreaView style={styles.container}>
@@ -79,6 +80,7 @@ const App = () => {
7980
isModalVisible={showWidget}
8081
user={user}
8182
customAttributes={customAttributes}
83+
colorScheme={colorScheme}
8284
/>
8385
}
8486
@@ -142,6 +144,12 @@ The whole example is in the `/example` folder.
142144
<td>Website channel token</td>
143145
</tr>
144146
<tr>
147+
<td>colorScheme</td>
148+
<td> light </td>
149+
<td> String </td>
150+
<td>Widget color scheme (light/dark/auto)</td>
151+
</tr>
152+
<tr>
145153
<td>locale</td>
146154
<td> en </td>
147155
<td> String </td>
@@ -180,4 +188,4 @@ Feel free to send us feedback on [Twitter](https://twitter.com/chatwootapp) or [
180188

181189
If there's anything you'd like to chat about, please feel free to join our [Discord](https://discord.gg/cJXdrwS) chat!
182190

183-
_Chatwoot_ &copy; 2017-2022, Chatwoot Inc - Released under the MIT License.
191+
_Chatwoot_ &copy; 2017-2023, Chatwoot Inc - Released under the MIT License.

examples/.buckconfig

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/.bundle/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUNDLE_PATH: "vendor/bundle"
2+
BUNDLE_FORCE_RUBY_PLATFORM: 1

examples/.flowconfig

Lines changed: 0 additions & 66 deletions
This file was deleted.

examples/.gitattributes

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/.gitignore

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ DerivedData
2020
*.hmap
2121
*.ipa
2222
*.xcuserstate
23+
ios/.xcode.env.local
2324

2425
# Android/IntelliJ
2526
#
@@ -28,32 +29,35 @@ build/
2829
.gradle
2930
local.properties
3031
*.iml
32+
*.hprof
33+
.cxx/
34+
*.keystore
35+
!debug.keystore
3136

3237
# node.js
3338
#
3439
node_modules/
3540
npm-debug.log
3641
yarn-error.log
3742

38-
# BUCK
39-
buck-out/
40-
\.buckd/
41-
*.keystore
42-
!debug.keystore
43-
4443
# fastlane
4544
#
4645
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
4746
# screenshots whenever they are needed.
4847
# For more information about the recommended setup visit:
4948
# https://docs.fastlane.tools/best-practices/source-control/
5049

51-
*/fastlane/report.xml
52-
*/fastlane/Preview.html
53-
*/fastlane/screenshots
50+
**/fastlane/report.xml
51+
**/fastlane/Preview.html
52+
**/fastlane/screenshots
53+
**/fastlane/test_output
5454

5555
# Bundle artifact
5656
*.jsbundle
5757

58-
# CocoaPods
58+
# Ruby / CocoaPods
5959
/ios/Pods/
60+
/vendor/bundle/
61+
62+
# Temporary files created by Metro to check the health of the file watcher
63+
.metro-health-check*

examples/.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

examples/.prettierrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
2+
arrowParens: 'avoid',
3+
bracketSameLine: true,
24
bracketSpacing: false,
3-
jsxBracketSameLine: true,
45
singleQuote: true,
56
trailingComma: 'all',
6-
arrowParens: 'avoid',
77
};

examples/.ruby-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/App.js renamed to examples/App.tsx

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import {
77
TextInput,
88
TouchableOpacity,
99
View,
10+
StyleSheet,
1011
} from 'react-native';
1112

12-
import styles from './style';
1313
const App = () => {
1414
const [showWidget, toggleWidget] = useState(false);
1515
const [user, setUser] = useState({
@@ -24,8 +24,8 @@ const App = () => {
2424
pricingPlan: 'paid',
2525
status: 'active',
2626
};
27-
const websiteToken = 'gUuQpz4wKSBZ36zpWyXtShrJ';
28-
const baseUrl = 'https://staging.chatwoot.com';
27+
const websiteToken = 'uDDidz9scvbDBcxjCfwdWJRZ';
28+
const baseUrl = 'https://mobile.chatwoot.app';
2929
const [locale, setLocale] = useState('en');
3030

3131
return (
@@ -58,7 +58,7 @@ const App = () => {
5858
<TextInput
5959
style={styles.input}
6060
value={locale}
61-
onChangeText={text => setLocale(locale)}
61+
onChangeText={() => setLocale(locale)}
6262
/>
6363
<Text style={styles.label}>Avatar</Text>
6464
<TextInput
@@ -73,15 +73,15 @@ const App = () => {
7373
/>
7474
<TouchableOpacity
7575
style={styles.button}
76-
onPress={() => toggleWidget(true)}
77-
underlayColor="#fff">
76+
onPress={() => toggleWidget(true)}>
7877
<Text style={styles.buttonText}>Open Chatwoot Widget</Text>
7978
</TouchableOpacity>
8079
</View>
8180
<ChatWootWidget
8281
websiteToken={websiteToken}
8382
locale={locale}
8483
baseUrl={baseUrl}
84+
colorScheme="dark"
8585
closeModal={() => toggleWidget(false)}
8686
isModalVisible={showWidget}
8787
user={user}
@@ -91,4 +91,49 @@ const App = () => {
9191
);
9292
};
9393

94+
const styles = StyleSheet.create({
95+
container: {
96+
flex: 1,
97+
justifyContent: 'center',
98+
alignItems: 'center',
99+
},
100+
modal: {
101+
flex: 1,
102+
paddingVertical: 32,
103+
},
104+
105+
button: {
106+
height: 48,
107+
marginTop: 32,
108+
paddingTop: 8,
109+
paddingBottom: 8,
110+
backgroundColor: '#1F93FF',
111+
borderRadius: 8,
112+
borderWidth: 1,
113+
borderColor: '#fff',
114+
justifyContent: 'center',
115+
},
116+
buttonText: {
117+
color: '#fff',
118+
textAlign: 'center',
119+
paddingLeft: 10,
120+
fontWeight: '600',
121+
fontSize: 16,
122+
paddingRight: 10,
123+
},
124+
label: {
125+
marginTop: 16,
126+
},
127+
input: {
128+
height: 40,
129+
width: 300,
130+
borderColor: 'gray',
131+
borderWidth: 1,
132+
marginTop: 8,
133+
fontWeight: '600',
134+
fontSize: 16,
135+
color: 'gray',
136+
},
137+
});
138+
94139
export default App;

examples/Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4+
ruby '>= 2.6.10'
5+
6+
gem 'cocoapods', '>= 1.11.3'

0 commit comments

Comments
 (0)