Skip to content

Commit

Permalink
Update README.md (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
safaiyeh authored Jan 9, 2021
1 parent ce99ebd commit e18c8c4
Showing 1 changed file with 4 additions and 63 deletions.
67 changes: 4 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Cookie Manager for React Native
This module was ported from [joeferraro/react-native-cookies](https://github.com/joeferraro/react-native-cookies). This would not exist without the work of the original author, [Joe Ferraro](https://github.com/joeferraro).

## Important notices & Breaking Changes
- **v6.0.0**: Package name updated to `@react-native-cookies/cookies`.
- **v5.0.0**: Peer Dependency of >= React Native 0.60.2
- **v4.0.0**: Android SDK version bumpted to 21
- **v3.0.0**: Remove React Native Core dependencies, CookieManager.set() support for Android
Expand All @@ -29,7 +30,7 @@ Currently lacking support for Windows, macOS, and web. Support for these platfor
## Installation

```
yarn add @react-native-community/cookies
yarn add @react-native-cookies/cookies
```

Then link the native iOS package
Expand All @@ -38,66 +39,6 @@ Then link the native iOS package
npx pod-install
```

## Setup (React Native < 0.60.0)

### Automatic (recommended)

```
react-native link @react-native-community/cookies
```

### Manual

If automatic linking does not work, you can manually link this library by following the instructions below:

#### iOS

1. Open your project in Xcode, right click on `Libraries` and click `Add Files to "Your Project Name"` Look under `node_modules/@react-native-community/cookies/ios` and add `RNCookieManagerIOS.xcodeproj`.
2. Add `libRNCookieManagerIOS.a` to `Build Phases -> Link Binary With Libraries.
3. Clean and rebuild your project

#### Android

Run `react-native link` to link the cookies library.

Or if you have trouble, make the following additions to the given files manually:

**android/settings.gradle**

```gradle
include ':@react-native-community_cookies'
project(':@react-native-community_cookies').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/cookies/android')
```

**android/app/build.gradle**

```gradle
dependencies {
...
implementation project(':@react-native-community_cookies')
}
```

**MainApplication.java**

On top, where imports are:

```java
import com.reactnativecommunity.cookies.CookieManagerPackage;
```

Add the `CookieManagerPackage` class to your list of exported packages.

```java
@Override
protected List<ReactPackage> getPackages() {
return Arrays.asList(
new MainReactPackage(),
new CookieManagerPackage()
);
}
```

## Usage

A cookie object can have one of the following fields:
Expand All @@ -120,7 +61,7 @@ export interface Cookies {
```

```javascript
import CookieManager from '@react-native-community/cookies';
import CookieManager from '@react-native-cookies/cookies';

// set a cookie
CookieManager.set('http://example.com', {
Expand Down Expand Up @@ -201,7 +142,7 @@ To use this _CookieManager_ with WebKit-Support we extended the interface with t
##### Usage

```javascript
import CookieManager from '@react-native-community/cookies';
import CookieManager from '@react-native-cookies/cookies';

const useWebKit = true;

Expand Down

0 comments on commit e18c8c4

Please sign in to comment.