- operating system:
- MacOS 10.15.7 or above
- Tools collection:
- Xcode 13.4 or above (if developing iOS platform reference)
- Android studio 2021.3.1 or above (if developing Android platform applications) (as for short)
- Visual Studio Code latest (vscode for short)
- Compile and run environment:
- Java JDK 1.8.0 or above (it is recommended to use Android studio's own)
- Objective-C 2.0 or above (recommended to use Xcode comes with it)
- Typescript 4.0 or above
- Nodejs 16.18.0 or above (brew installation is recommended)
- yarn 1.22.19 or above (brew installation is recommended)
- React-Native 0.63.5 or above
- npm and related tools (not recommended, please solve related problems by yourself)
- expo 6.0.0 or above
- Use
vscode
to open the projectreact-native-chat-library
- Use
terminal
to initialize the projectyarn
- If it is the first project initialization, you also need to execute the command
yarn run generate-source-env
to generate the corresponding files. For example:env.ts
.
Note yarn
will execute additional commands. For developers who don’t understand commands, if they need to use npm
command instead, they need to understand more trustworthy content.
Note When creating this project, the scaffolding has preset some yarn
related commands, so it is recommended to use yarn
to complete most of the work.
Note Because example
uses firebase cloud message (fcm)
related content, if users need to use related content, they need to set the corresponding file (GoogleService-Info.plist is required for iOS platform, google-services is required for Android platform .json), if you don’t need it, just delete the relevant content.
The operation steps are as follows:
- Use
terminal
to change directory toexample
- Execute the command
yarn run iOS
to compile and run theiOS
application - Execute the command
yarn run Android
to compile and run theAndroid
application
NOTE This mode is deprecated for compilation.
Modify Command Please refer to example/package.json
related content.
Reference For more information on compiling and running commands, please refer to expo
related content.
Running an application in development mode requires additional local services, which can dynamically detect file source code modifications and perform dynamic debugging.
- Using the
terminal
tool, switch tocd example/iOS
- Using the
terminal
tool, execute theyarn run start
command to start the service.
compile and build the project
In the compilation phase, the iOS
platform needs to execute the pod install
command to generate the Xcode xcworkspace
project file.
- Using the
terminal
tool, switch tocd example/iOS
- Use the
terminal
tool to executepod install
to generateexample/iOS/example.xcworkspace
. - Use the
Xcode
tool to open the project fileexample/iOS/example.xcworkspace
- If you use the simulator, you need to choose
iOS
12.4 or below - If you use a real device, the developer mode needs to be enabled on the real device, and
singing & capabilities
related content needs to be set in the project - Use the
Xcode
tool to execute the compile operation.
Note For developers who do not use Xcode
to compile, they can use the official recommended method to compile. If there is a problem, it is generally difficult to find the cause of the problem.
Note The react-native
native service is automatically started, not the expo
service, and an error will be reported. Just turn off the service.
run the project
Use the command provided by the expo
tool to start the local service, refer to the General Operation
chapter.
Note If the running application is not loaded correctly, you need to refresh the page, or close the application and restart it. For error reporting problems, you can generally solve them through corresponding prompts.
compile and build the project
During the compilation phase, the Android
platform needs to execute the sync
initialization project.
- Start the
Android studio (referred to as as)
tool, open the project fileexample/Android
, - Click the
sync project with gradle files
button to execute theinitialization
operation, - If using an emulator, please select or create an emulator of version 6.0 or above,
- If it is a real device, you need to enable the developer mode of the device,
- When
sync
is successful, click therun app
button to compile and run the project.
Note If you use as
for the first time, it may take a lot of downloading and the waiting time will be longer.
Note Android platform devices need data forwarding. The command for data forwarding is
adb reverse tcp:8081 tcp:8081. Since
exampleuses the
expo` tool, it does it for you, so no manual work is required.
run the project
Use the command provided by the expo
tool to start the local service, refer to the General Operation
chapter.
Note If the running application is not loaded correctly, you need to refresh the page, or close the application and restart it. For error reporting problems, you can generally solve them through corresponding prompts.
Note Android platform devices need data forwarding. The command for data forwarding is
adb reverse tcp:8081 tcp:8081. Since
exampleuses the
expo` tool, it does it for you, so no manual work is required.