- 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
vscodeto open the projectreact-native-chat-library - Use
terminalto initialize the projectyarn - If it is the first project initialization, you also need to execute the command
yarn run generate-source-envto 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
terminalto change directory toexample - Execute the command
yarn run iOSto compile and run theiOSapplication - Execute the command
yarn run Androidto compile and run theAndroidapplication
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
terminaltool, switch tocd example/iOS - Using the
terminaltool, execute theyarn run startcommand 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
terminaltool, switch tocd example/iOS - Use the
terminaltool to executepod installto generateexample/iOS/example.xcworkspace. - Use the
Xcodetool to open the project fileexample/iOS/example.xcworkspace - If you use the simulator, you need to choose
iOS12.4 or below - If you use a real device, the developer mode needs to be enabled on the real device, and
singing & capabilitiesrelated content needs to be set in the project - Use the
Xcodetool 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 filesbutton to execute theinitializationoperation, - 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
syncis successful, click therun appbutton 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 theexpo` 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 theexpo` tool, it does it for you, so no manual work is required.