You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41-43Lines changed: 41 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,62 +1,55 @@
1
1
2
-
# react-native-user-agent
2
+
# React Native User Agent
3
3
4
-
## Getting started
4
+
## Platforms Supported
5
5
6
-
Install with [npm](https://www.npmjs.com/) or [Yarn](https://yarnpkg.com/):
6
+
-[x] iOS
7
+
-[x] Android
7
8
8
-
npm:
9
-
```sh
10
-
npm install react-native-user-agent --save
11
-
```
9
+
## Getting Started Guide
10
+
11
+
1. Add react-native-user-agent to your dependencies
12
12
13
-
Yarn:
14
13
```sh
15
14
yarn add react-native-user-agent
16
15
```
17
16
18
-
### Mostly automatic installation
17
+
or, for npm use
19
18
20
-
`$ react-native link react-native-user-agent`
19
+
```sh
20
+
npm install react-native-user-agent --save
21
+
```
21
22
22
-
After that, add this to your `Podfile` and run `pod install`
23
+
2. Link native dependencies
23
24
24
-
```
25
-
pod 'RNUserAgent', :path => '../node_modules/react-native-user-agent/ios'
26
-
```
25
+
2.1 **react-native >= 0.60**
27
26
28
-
### Manual installation
27
+
Autolinking will take care of the link step, but for iOS, don't forget to run `pod install` in `ios/` folder
29
28
29
+
If you haven't set up cocoapods yet, please refer to [that article](https://engineering.brigad.co/demystifying-react-native-modules-linking-ae6c017a6b4a)
30
30
31
-
#### iOS
31
+
2.2 **react-native < 0.60**
32
32
33
-
1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
34
-
2. Go to `node_modules` ➜ `react-native-user-agent` and add `RNUserAgent.xcodeproj`
35
-
3. In XCode, in the project navigator, select your project. Add `libRNUserAgent.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
36
-
4. Run your project (`Cmd+R`)<
33
+
You have to call `link` command manualy:
37
34
38
-
#### Android
35
+
```sh
36
+
react-native link react-native-user-agent
37
+
```
39
38
40
-
1. Open up `android/app/src/main/java/[...]/MainApplication.java`
41
-
- Add `import com.bebnev.RNUserAgentPackage;` to the imports at the top of the file
42
-
- Add `new RNUserAgentPackage()` to the list returned by the `getPackages()` method
43
-
2. Append the following lines to `android/settings.gradle`:
44
-
```
45
-
include ':react-native-user-agent'
46
-
project(':react-native-user-agent').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-user-agent/android')
47
-
```
48
-
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
49
-
```
50
-
compile project(':react-native-user-agent')
51
-
```
39
+
*For manual linking*, please refer to:
40
+
-[that article](https://engineering.brigad.co/demystifying-react-native-modules-linking-964399ec731b) for Android
41
+
-[react-native own tutorial](https://facebook.github.io/react-native/docs/linking-libraries-ios) for iOS
| iOS | application-name/1.6.4.176 CFNetwork/897.15 Darwin/17.5.0 (iPhone/6s iOS/11.3) | Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E217 |
67
60
| Android | application-name/1.6.7.42 Dalvik/2.1.0 (Linux; U; Android 5.1.1; Android SDK built for x86 Build/LMY48X) | Mozilla/5.0 (Linux; Android 5.1.1; Android SDK built for x86 Build/LMY48X) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36 |
68
61
69
-
### Additionally:
62
+
Additionally module returns a set of constants, that are used in user agent string building.
70
63
71
-
Every version returns some constants that are used in user agent string building.
0 commit comments