React Native Zendesk Chat 项目教程
react-native-zendesk-chatReact Native Wrapper around Zendesk Chat v2项目地址:https://gitcode.com/gh_mirrors/re/react-native-zendesk-chat
1. 项目的目录结构及介绍
react-native-zendesk-chat/
├── android/
│ ├── app/
│ ├── build.gradle
│ ├── settings.gradle
│ └── ...
├── ios/
│ ├── ReactNativeZendeskChat/
│ ├── ReactNativeZendeskChat.xcodeproj/
│ └── ...
├── src/
│ ├── index.js
│ └── ...
├── package.json
├── README.md
└── ...
android/
: 包含Android项目的相关文件和配置。ios/
: 包含iOS项目的相关文件和配置。src/
: 包含项目的源代码文件。package.json
: 项目的依赖和脚本配置文件。README.md
: 项目的说明文档。
2. 项目的启动文件介绍
项目的启动文件通常是src/index.js
,它负责初始化Zendesk SDK并设置用户标识。以下是一个示例:
import RNZendeskChat from 'react-native-zendesk-chat';
// 初始化Zendesk SDK
RNZendeskChat.init({
key: '<chatAccountKey>',
appId: '<appId>',
url: '<zendeskUrl>',
clientId: '<zendeskClientId>'
});
// 设置用户标识
RNZendeskChat.setUserIdentity({
name: '<name>',
email: '<email>'
});
3. 项目的配置文件介绍
package.json
package.json
文件包含了项目的依赖、脚本和其他配置信息。以下是一个示例:
{
"name": "react-native-zendesk-chat",
"version": "1.0.0",
"description": "A React Native wrapper for Zendesk Chat SDK",
"main": "src/index.js",
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios"
},
"dependencies": {
"react": "^17.0.2",
"react-native": "^0.64.2",
"react-native-zendesk-chat": "file:./"
},
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/runtime": "^7.14.6",
"babel-jest": "^27.0.6",
"jest": "^27.0.6",
"metro-react-native-babel-preset": "^0.66.0",
"react-test-renderer": "^17.0.2"
},
"jest": {
"preset": "react-native"
}
}
android/build.gradle
android/build.gradle
文件包含了Android项目的构建配置。以下是一个示例:
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.1")
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
}
}
ios/Podfile
ios/Podfile
文件包含了iOS项目的依赖配置。以下是一个示例:
platform :ios, '10.0'
target 'ReactNativeZendeskChat' do
use_frameworks!
pod 'ZendeskChatSDK', '~> 2.0'
end
以上是React Native Zendesk Chat项目的基本教程,包含了项目的目录结构、启动文件和配置文件的介绍。希望对你有所帮助!
react-native-zendesk-chatReact Native Wrapper around Zendesk Chat v2项目地址:https://gitcode.com/gh_mirrors/re/react-native-zendesk-chat
© 版权声明
特别提醒: 内容为用户自行发布,如有侵权,请联系我们管理员删除,邮箱:mail@xieniao.com ,在收到您的邮件后我们会在3个工作日内处理。
相关文章
暂无评论...