Skip to content

Commit 8efb93c

Browse files
author
Spencer Lepine
authored
release React Native demo application (#104)
1 parent a5c7934 commit 8efb93c

Some content is hidden

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

41 files changed

+14700
-0
lines changed
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: React Native Chat CI
2+
# - Install, lint, test, and build production Expo application
3+
# - Runs only on changes to connectReactNativeChat/ folder
4+
5+
on:
6+
workflow_dispatch:
7+
push:
8+
branches: [ master ]
9+
paths: 'connectReactNativeChat/**'
10+
pull_request:
11+
branches: [ master ]
12+
paths: 'connectReactNativeChat/**'
13+
14+
jobs:
15+
build:
16+
runs-on: macos-12
17+
strategy:
18+
matrix:
19+
node-version: [16.x] # 18.x, 19.x
20+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21+
defaults:
22+
run:
23+
working-directory: ./connectReactNativeChat
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
- name: Use Node.js ${{ matrix.node-version }}
29+
uses: actions/setup-node@v3
30+
with:
31+
node-version: ${{ matrix.node-version }}
32+
33+
- name: Install Expo app dependencies
34+
run: yarn
35+
36+
- run: yarn lint
37+
38+
- name: Create endpoint.js config
39+
run: |
40+
cp endpoints.sample.js endpoints.js || echo "no endpoint.sample.js found"
41+
42+
- run: yarn test
43+
44+
- name: Create app.json config
45+
run: |
46+
rm app.json || echo "no app.json found, creating new"
47+
cp app.prod.json app.json
48+
49+
- name: Build the Expo application
50+
run: CI=1 npx expo prebuild --platform all
51+

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
## [1.4.0] - 2023-3-29
7+
### Changed
8+
- Connect React Native Chat - initial release of cross-platform Amazon Connect Chat solution
9+
610
## [1.3.3] - 2023-2-21
711
### Changed
812
- Custom Chat Widget - Support Custom Chat Duration

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ At the moment, these are the solutions in this repo:
2020
5. **[customChatWidget](https://github.com/amazon-connect/amazon-connect-chat-ui-examples/tree/master/customChatWidget)**
2121
Custom Chat Widget for Amazon Connect, with a Chat Form that can be easily plugged into a webpage. This solution helps customers to have Amazon Connect Custom Chat Widget in their website, by applying simple configuration parameters. It also makes customizing the `amazon-connect-interface.js` file easier, and can be used as an easy way to host custom widget on a webpage.
2222

23+
6. **[connectReactNativeChat](https://github.com/amazon-connect/amazon-connect-chat-ui-examples/tree/master/connectReactNativeChat)**
24+
React Native demo Chat application for Amazon Connect. This cross-platform solution implements basic Chat JS functionality and is fully customizable. Follow the provided documentation to build with [`amazon-connect-chatjs@^1.5.0`](https://github.com/amazon-connect/amazon-connect-chatjs).
25+
2326
## Resources
2427

2528
Here are a few resources to help you implement chat in your contact center:

connectReactNativeChat/.eslintrc

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"settings": {
7+
"react": {
8+
"version": "detect"
9+
}
10+
},
11+
"extends": [
12+
"plugin:react/recommended"
13+
],
14+
"parserOptions": {
15+
"ecmaVersion": "latest",
16+
"sourceType": "module"
17+
},
18+
"plugins": [
19+
"react"
20+
],
21+
"rules": {
22+
"react/prop-types": "off",
23+
"global-require": 0
24+
},
25+
"ignorePatterns": [
26+
"assets",
27+
"ios",
28+
"android"
29+
],
30+
"overrides": [
31+
{
32+
"files": [
33+
"**/*.test.js",
34+
"**/*.test.jsx"
35+
],
36+
"env": {
37+
"jest": true
38+
}
39+
}
40+
]
41+
}

connectReactNativeChat/.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
node_modules
2+
.expo/
3+
dist/
4+
npm-debug.*
5+
*.jks
6+
*.p8
7+
*.p12
8+
*.key
9+
*.mobileprovision
10+
*.orig.*
11+
web-build/
12+
13+
# macOS
14+
.DS_Store
15+
16+
# Temporary files created by Metro to check the health of the file watcher
17+
.metro-health-check*
18+
19+
endpoints.js
20+
yarn-error.log
21+
.dev
22+
android
23+
ios
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

connectReactNativeChat/.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 2,
4+
"semi": false,
5+
"singleQuote": true,
6+
"printWidth": 120
7+
}

connectReactNativeChat/App.js

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: MIT-0
3+
4+
import React from "react";
5+
import { View, Image } from "react-native";
6+
import { createStackNavigator } from "@react-navigation/stack";
7+
import { NavigationContainer } from "@react-navigation/native";
8+
9+
import ChatWrapper from "./src/components/ChatWrapper";
10+
import GiftedChatWidget from "./src/components/ChatWidget";
11+
import DebuggerWidget from "./src/components/DebuggerWidget";
12+
import ChatForm from "./src/components/ChatForm";
13+
14+
import { LogBox } from "react-native";
15+
import { ENABLE_REACTNATIVE_LOGBOX } from "./config";
16+
if (!ENABLE_REACTNATIVE_LOGBOX) {
17+
LogBox.ignoreAllLogs();
18+
}
19+
20+
const ChatScreen = ({ navigation }) => {
21+
return (
22+
<ChatWrapper
23+
navigation={navigation}
24+
ChatWidgetComponent={GiftedChatWidget}
25+
/>
26+
);
27+
};
28+
29+
const HomeScreen = ({ navigation }) => (
30+
<View
31+
style={{
32+
flex: 1,
33+
alignItems: "center",
34+
padding: 10,
35+
marginTop: 100,
36+
}}
37+
>
38+
<Image
39+
source={require("./assets/connect.png")}
40+
style={{
41+
height: 90,
42+
width: 100,
43+
padding: 10,
44+
}}
45+
alt="Connect logo"
46+
/>
47+
48+
<ChatForm openChatScreen={() => navigation.navigate("Chat")} />
49+
50+
<DebuggerWidget />
51+
</View>
52+
);
53+
54+
const Stack = createStackNavigator();
55+
56+
const App = () => {
57+
return (
58+
<NavigationContainer>
59+
<Stack.Navigator initialRouteName="Home">
60+
<Stack.Screen name="Home" component={HomeScreen} />
61+
<Stack.Screen name="Chat" component={ChatScreen} />
62+
</Stack.Navigator>
63+
</NavigationContainer>
64+
);
65+
};
66+
67+
export default App;

0 commit comments

Comments
 (0)