Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
c0e0575
initial config based on create-react-native-library
EmilianoSanchez Jun 7, 2021
81efe90
base implementation, based on browser sdk
EmilianoSanchez Jun 8, 2021
a8c30ca
added replace to fix travis issue
EmilianoSanchez Jun 8, 2021
5fd58be
Merge branch 'setup_repo' into base_implementation
EmilianoSanchez Jun 8, 2021
694f0c3
updated comment
EmilianoSanchez Jun 10, 2021
4006f63
emi's feedback
EmilianoSanchez Jun 14, 2021
5d85e78
emi's feedback
EmilianoSanchez Jun 14, 2021
862b3df
Merge pull request #2 from splitio/base_implementation
EmilianoSanchez Jun 14, 2021
69f6229
Merge pull request #1 from splitio/setup_repo
EmilianoSanchez Jun 14, 2021
87103a8
updated travis to publish NPM package in Artifactory
EmilianoSanchez Jun 22, 2021
024ae9a
try
EmilianoSanchez Jun 22, 2021
f8a1c0b
fix travis config
EmilianoSanchez Jun 22, 2021
6a90f26
fix travis config
EmilianoSanchez Jun 22, 2021
bef041c
fix travis config
EmilianoSanchez Jun 22, 2021
4c880d2
fix package.json fields
EmilianoSanchez Jun 23, 2021
c751f88
added getFetch function
EmilianoSanchez Jun 25, 2021
e33ee68
chore: travis config to publish on development
EmilianoSanchez Jun 28, 2021
51fece7
polish getModules function
EmilianoSanchez Jul 5, 2021
8408cdc
polish splitFactory function
EmilianoSanchez Jul 5, 2021
b97799e
RNSignalListener implementation
EmilianoSanchez Jul 5, 2021
0d32b61
android and ios RNEventSource
EmilianoSanchez Jul 6, 2021
2ed0ad9
src files and podspec
EmilianoSanchez Jul 6, 2021
4a5e110
added license copy
EmilianoSanchez Jul 6, 2021
f21ac5b
removed background timers
EmilianoSanchez Jul 7, 2021
f825a14
added logs
EmilianoSanchez Jul 8, 2021
8b5463c
prepare rc
EmilianoSanchez Jul 8, 2021
d181243
polishing
EmilianoSanchez Jul 12, 2021
f9e21c7
Emi's feedback
EmilianoSanchez Jul 15, 2021
875e512
Merge pull request #5 from splitio/event_source
EmilianoSanchez Jul 15, 2021
f23bd2b
Merge pull request #3 from splitio/travis_config
EmilianoSanchez Jul 15, 2021
aa0623b
Merge branch 'development' into rn_signal_listener
EmilianoSanchez Jul 15, 2021
40becff
added UTs and fixed some issues
EmilianoSanchez Jul 19, 2021
a301877
added example to use for testing and debugging purposes
EmilianoSanchez Jul 19, 2021
6567897
moved AppState mock to reuse
EmilianoSanchez Jul 20, 2021
76900cf
Merge pull request #4 from splitio/rn_signal_listener
EmilianoSanchez Jul 20, 2021
f931b7b
Merge branch 'development' into example_for_tests_and_debugging
EmilianoSanchez Jul 20, 2021
a754a47
fix: updates on native EventSource implementations
EmilianoSanchez Jul 23, 2021
6d71511
added complementary files
EmilianoSanchez Jul 23, 2021
e23af0a
chore: Emi's feedback
EmilianoSanchez Jul 23, 2021
3db2660
Merge pull request #7 from splitio/example_for_tests_and_debugging
EmilianoSanchez Jul 23, 2021
6be64e2
refactor: long to int constants
EmilianoSanchez Jul 26, 2021
dac330e
fix
EmilianoSanchez Jul 27, 2021
a1cf091
Merge pull request #6 from splitio/event_source_updates
EmilianoSanchez Jul 27, 2021
015485c
Merge branch 'development' into complementary_files
EmilianoSanchez Jul 27, 2021
95de3ed
prepare public rc
EmilianoSanchez Jul 27, 2021
94eb8f3
polish compatibility
EmilianoSanchez Jul 28, 2021
b098243
rename package id for Android native module
EmilianoSanchez Jul 28, 2021
0aa4177
update README and CHANGES
EmilianoSanchez Jul 29, 2021
583db15
removed ios Tests
EmilianoSanchez Jul 29, 2021
f71fbd8
added link to public docs
EmilianoSanchez Jul 29, 2021
7d0237e
type definition polishing
EmilianoSanchez Jul 29, 2021
32733f4
Merge pull request #9 from splitio/rename_native_modules
EmilianoSanchez Jul 29, 2021
d75ddf2
Merge pull request #8 from splitio/complementary_files
EmilianoSanchez Jul 29, 2021
f3c3851
prepare release
EmilianoSanchez Jul 29, 2021
dda213f
Merge pull request #10 from splitio/release_v0.0.1
EmilianoSanchez Jul 29, 2021
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
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf

[*.{js,json,ts}]
indent_style = space
indent_size = 2
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# React Native SDK

## What did you accomplish?

## How do we test the changes introduced in this PR?

## Extra Notes
60 changes: 60 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# OSX
.DS_Store

# XDE
.expo/

# VSCode
.vscode/
jsconfig.json

# Xcode
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IJ
.idea
.gradle
local.properties
android.iml

# Examples
examples/

# node.js and logs
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
logs
*.log

# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore

# Expo
.expo/*

# Builds
lib*/
esm*/
cjs*/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v14
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
types/
example/
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
language: node_js

node_js:
- "lts/*"

cache: npm

git:
depth: false

before_script:
- npm install

script:
- npm run check
- npm run test
- npm run build
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
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright © 2021 Split Software, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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.
17 changes: 17 additions & 0 deletions RNSplit.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))

Pod::Spec.new do |s|
s.name = "RNSplit"
s.module_name = "RNSplit"
s.summary = package["description"]
s.version = package["version"]
s.author = package["author"]
s.license = package["license"]
s.homepage = package["homepage"]
s.platform = :ios, "9.0"
s.source = { :git => "https://github.com/splitio/react-native-client.git", :tag => "v#{s.version}" }
s.source_files = "ios/**/*.{h,m}"
s.dependency "React"
end
20 changes: 20 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def safeExtGet(name, fallback) {
rootProject.ext.has(name) ? rootProject.ext.get(name) : fallback
}

apply plugin: "com.android.library"

android {
compileSdkVersion safeExtGet("compileSdkVersion", 28)

defaultConfig {
minSdkVersion safeExtGet("minSdkVersion", 16)
targetSdkVersion safeExtGet("targetSdkVersion", 28)
versionCode 1
versionName "1.0"
}
}

dependencies {
implementation "com.facebook.react:react-native:+"
}
4 changes: 4 additions & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.split.rnsplit">
</manifest>
Loading