Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@ script:
- npm run check
- npm run test
- npm run build
# @TODO remove next command and `publishConfig` field in package.json when publishing as a public package in NPM registry
- if [[ $TRAVIS_BRANCH == "development" && $TRAVIS_EVENT_TYPE != "pull_request" ]]; then echo "publishing" ; curl -u${ARTIFACTORY_USER}:${ARTIFACTORY_PASSWORD} https://splitio.jfrog.io/artifactory/api/npm/auth >> ~/.npmrc ; npm publish --tag rc ; else echo "no publishing" ; fi
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0.0.1 (July 29, 2021)
- Initial public release. Check the official documentation for details: https://help.split.io/hc/en-us/articles/4406066357901
47 changes: 47 additions & 0 deletions CONTRIBUTORS-GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Contributing to the Split React Native SDK

Split SDK is an open source project and we welcome feedback and contribution. The information below describes how to build the project with your changes, run the tests, and send the Pull Request(PR).

## Development

### Development process

1. Fork the repository and create a topic branch from `development` branch. Please use a descriptive name for your branch.
2. While developing, use descriptive messages in your commits. Avoid short or meaningless sentences like: "fix bug".
3. Make sure to add tests for both positive and negative cases.
4. If your changes have any impact on the public API, make sure you update the TypeScript declaration files as well as it's related test file.
5. Run the linter script of the project and fix any issues you find.
6. Run the build script and make sure it runs with no errors.
7. Run all tests and make sure there are no failures.
8. `git push` your changes to GitHub within your topic branch.
9. Open a Pull Request(PR) from your forked repo and into the `development` branch of the original repository.
10. When creating your PR, please fill out all the fields of the PR template, as applicable, for the project.
11. Check for conflicts once the pull request is created to make sure your PR can be merged cleanly into `development`.
12. Keep an eye out for any feedback or comments from Split's SDK team.

### Building the SDK

The build is done with the command `npm run build`. Refer to [package.json](package.json) for more insight on the build script.

### Running tests

All tests can be run at once with the command `npm run test`.

### Linting and other useful checks

Consider running the linter and type check script (`npm run check`) and fixing any issues before pushing your changes.

If you want to debug your changes consuming it from a test application, you could use the React Native App example at `/example` folder:

```bash
cd example/
npm install
npm run android # to run in an Android emulator
npm run ios # to run on a iOS emulator
```

Remember to check and follow the [React Native setting up guidelines](https://reactnative.dev/docs/environment-setup) before running the example.

# Contact

If you have any other questions or need to contact us directly in a private manner send us a note at sdks@split.io
79 changes: 78 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,78 @@
# react-native-client
# Split JavaScript SDK for React Native

[![npm version](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-react-native.svg)](https://badge.fury.io/js/%40splitsoftware%2Fsplitio) [![Build Status](https://travis-ci.com/splitio/react-native-client.svg?branch=main)](https://travis-ci.com/splitio/react-native-client)

## Overview
This SDK is designed to work with Split, the platform for controlled rollouts, which serves features to your users via a Split feature flag to manage your complete customer experience.

[![Twitter Follow](https://img.shields.io/twitter/follow/splitsoftware.svg?style=social&label=Follow&maxAge=1529000)](https://twitter.com/intent/follow?screen_name=splitsoftware)

## Compatibility
The React Native SDK is a library for React Native applications. The library was build with native modules to support streaming in Android and iOS, and therefore it requires linking the native dependency in order to use streaming. For Expo applications, streaming is not supported by default but a polyfill can be used instead. Check our [public documentation](https://help.split.io/hc/en-us/articles/4406066357901) for installation details.

## Getting started
Below is a simple App.jsx example that describes the instantiation and most basic usage of our SDK:
```javascript
// Import the SDK
import { SplitFactory } from '@splitsoftware/splitio-react-native';

// Instantiate the SDK
var factory = SplitFactory({
core: {
authorizationKey: 'YOUR_SDK_API_KEY',
key: 'CUSTOMER_ID'
}
});

// Set a callback to listen for the SDK_READY event, to make sure the SDK is properly loaded before asking for a treatment
client.on(client.Event.SDK_READY, function() {
var treatment = client.getTreatment('SPLIT_NAME');
if (treatment == 'on') {
// insert code here for on treatment
} else if (treatment == 'off') {
// insert code here for off treatment
} else {
// insert your control treatment code here
}
});
```

Please refer to [React Native SDK](https://help.split.io/hc/en-us/articles/4406066357901) to learn about all the functionality provided by our SDK as well as specifics for configuration options available for tailoring it to your current application setup.

## Submitting issues
The Split team monitors all issues submitted to this [issue tracker](https://github.com/splitio/react-native-client/issues). We encourage you to use this issue tracker to submit any bug reports, feedback, and feature enhancements. We'll do our best to respond in a timely manner.

## Contributing
Please see [Contributors Guide](CONTRIBUTORS-GUIDE.md) to find all you need to submit a Pull Request (PR).

## License
Licensed under the Apache License, Version 2.0. See: [Apache License](http://www.apache.org/licenses/).

## About Split

Split is the leading Feature Delivery Platform for engineering teams that want to confidently deploy features as fast as they can develop them. Split’s fine-grained management, real-time monitoring, and data-driven experimentation ensure that new features will improve the customer experience without breaking or degrading performance. Companies like Twilio, Salesforce, GoDaddy and WePay trust Split to power their feature delivery.

To learn more about Split, contact hello@split.io, or get started with feature flags for free at https://www.split.io/signup.

Split has built and maintains SDKs for:

* .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
* GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
* Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
* Javascript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
* Javascript for React Native [Github](https://github.com/splitio/react-native-client) [Docs](https://help.split.io/hc/en-us/articles/4406066357901)
* PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
* Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)
* React [Github](https://github.com/splitio/react-client) [Docs](https://help.split.io/hc/en-us/articles/360038825091-React-SDK)
* Redux [Github](https://github.com/splitio/redux-client) [Docs](https://help.split.io/hc/en-us/articles/360038851551-Redux-SDK)
* Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK)

For a comprehensive list of open source projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20).

**Learn more about Split:**

Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](http://help.split.io) for more detailed information.
4 changes: 2 additions & 2 deletions Split.podspec → RNSplit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))

Pod::Spec.new do |s|
s.name = "Split"
s.module_name = "Split"
s.name = "RNSplit"
s.module_name = "RNSplit"
s.summary = package["description"]
s.version = package["version"]
s.author = package["author"]
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.jonnybgod.RNEventSource">
package="io.split.rnsplit">
</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.jonnybgod.RNEventSource;
package io.split.rnsplit;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.jonnybgod.RNEventSource;
package io.split.rnsplit;

import java.util.Arrays;
import java.util.ArrayList;
Expand All @@ -11,9 +11,9 @@
import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.bridge.JavaScriptModule;

public class RNEventSourcePackage implements ReactPackage {
public class RNSplitPackage implements ReactPackage {

public RNEventSourcePackage() {}
public RNSplitPackage() {}

@Override
public List<NativeModule> createNativeModules(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import com.github.jonnybgod.RNEventSource.RNEventSourcePackage;
import io.split.rnsplit.RNSplitPackage;

public class MainApplication extends Application implements ReactApplication {

Expand All @@ -27,7 +27,7 @@ protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new RNEventSourcePackage());
packages.add(new RNSplitPackage());
return packages;
}

Expand Down
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ target 'example' do
# Pods for testing
end

pod 'Split', :path => '../..'
pod 'RNSplit', :path => '../..'

# Enables Flipper.
#
Expand Down
10 changes: 5 additions & 5 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ PODS:
- React-cxxreact (= 0.64.1)
- React-jsi (= 0.64.1)
- React-perflogger (= 0.64.1)
- Split (0.0.1-beta.5):
- RNSplit (0.0.1-canary.2):
- React
- Yoga (1.14.0)
- YogaKit (1.18.1):
Expand Down Expand Up @@ -371,7 +371,7 @@ DEPENDENCIES:
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- Split (from `../..`)
- RNSplit (from `../..`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
Expand Down Expand Up @@ -444,7 +444,7 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
Split:
RNSplit:
:path: "../.."
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"
Expand Down Expand Up @@ -488,10 +488,10 @@ SPEC CHECKSUMS:
React-RCTVibration: 4b99a7f5c6c0abbc5256410cc5425fb8531986e1
React-runtimeexecutor: ff951a0c241bfaefc4940a3f1f1a229e7cb32fa6
ReactCommon: bedc99ed4dae329c4fcf128d0c31b9115e5365ca
Split: 10ecd4f342ba7f13472c961379e733ac8782098a
RNSplit: 428e2a7c18fd621ec3494d0e39b31bab158104d9
Yoga: a7de31c64fe738607e7a3803e3f591a4b1df7393
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: b0666e27b6e3a8b7e47f93e272b1116fcf0a20e3
PODFILE CHECKSUM: 446a3cfd56a34c58128e1c92cebd53fb2ce3971a

COCOAPODS: 1.10.1
2 changes: 1 addition & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';

import { SplitFactory, DebugLogger } from 'splitio-react-native-private';
import { SplitFactory, DebugLogger } from '@splitsoftware/splitio-react-native';

// Ignore Android JS timers warning. No need to worry about it: https://github.com/facebook/react-native/issues/12981#issuecomment-652745831
LogBox.ignoreLogs(['Setting a timer']);
Expand Down
2 changes: 1 addition & 1 deletion example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
"paths": {
"splitio-react-native-private": ["../"]
"@splitsoftware/splitio-react-native": ["../"]
}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
Expand Down
Loading