SDK development
Work with the React Native SDK source code.
SDK development guide
The project consists of TypeScript code in the /src folder, a native Android module implementation in /android, and a native iOS module in /ios. To see SDK functionality in action, we provide an example application you can find in /example.
TypeScript
- We use Yarn package manager, since it uses caching of packages and is overall faster to install dependencies than NPM. When developing new features and running the example app you'll need to do this a LOT. Run
yarnto install dependencies. - We use TypeScript to improve the developer experience when using the SDK. The code is located in
/srcand transpiled into/lib, which is published to NPM. Useyarn run buildto transpile TypeScript to JavaScript (including type definitions). - We use Jest to run unit tests. Use
yarn testto run unit tests. - We use ESLint to check our code for issues and format it. Use
yarn run lintto detect issues oryarn run lint --fixto fix them.
Android
The native Android module is written in Kotlin, since that's also used for our native Android SDK.
React Native is smart and installs Gradle dependencies from the /node_modules folder. Make sure you run yarn at the project root level to install all dependencies before working on the native Android module. You can work on the native module in Android Studio, or use Gradle wrapper directly.
- We use ktlint to format the code, use
./gradlew ktlintFormatto fix code formatting issues. - We use JUnit4 to run unit tests. Use
./gradlew testto run unit tests.
iOS
The native iOS module is written in Swift, since that's also used for our native iOS SDK.
React Native is smart and installs dependencies from the /node_modules folder. Make sure you run yarn at the project root level to install all dependencies before working on the native iOS module. In /ios, you'll find an XCode workspace that you can ise to open and build/test the native module.
- We use CocoaPods to manage dependencies. You'll see a
Podfilethat defines dependencies for the "standalone" XCode project that we use to develop the native iOS module. These pods won't be part of released package. The.podspecfile is located at package level. Runpod installbefore opening the XCode project and starting development. - We use SwiftLint to format the code. After installing SwiftLint on your development machine, you can use
swiftlintto check your code. - We use Quick to write tests, you can run them directly in XCode.
Updated about 1 year ago
