Skip to content

Commit 321697f

Browse files
authored
Merge pull request #11 from juspay/update/readme
updated readme to include ios documentation
2 parents 57ec3b6 + db85a63 commit 321697f

File tree

1 file changed

+41
-22
lines changed

1 file changed

+41
-22
lines changed

README.md

+41-22
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,89 @@
11
# Hyper SDK React WebView
22

3-
Custom webview for a hyper-sdk webview integration for react-native apps.
3+
A custom webview for integrating hyper-sdk with React Native apps.
44

55
## Installation
66

7+
To install using npm:
8+
79
```sh
810
npm install hyper-sdk-react-webview
9-
1011
```
1112

12-
with `yarn`
13+
To install using yarn:
1314

1415
```sh
1516
yarn add hyper-sdk-react-webview
16-
1717
```
1818

19-
**NOTE** please make sure that you have also installed `react-native-webview` as a dependency. Even though it's declared as a peer dependency, react-native doesn't pickup it's native-build files unless it's specified as a direct dependency of the app.
19+
**NOTE:** Ensure that `react-native-webview` is also installed as a dependency. Although it is declared as a peer dependency, React Native requires it to be a direct dependency to include its native build files.
2020

2121
## Usage
2222

23-
Add our package repository to your app's `build.gradle`
23+
### Android
24+
25+
Add our package repository to your app's `build.gradle`:
26+
2427
```groovy
25-
// ..
2628
allprojects {
2729
repositories {
28-
// ..
2930
maven { url "https://maven.juspay.in/jp-build-packages/hyper-sdk/" }
3031
}
3132
}
3233
```
3334

34-
Add the required intent handling in `MainActivity.kt`
35+
Add the required intent handling in `MainActivity.kt`:
3536

3637
```kotlin
37-
// ...
38-
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
39-
super.onActivityResult(requestCode, resultCode, data)
40-
if (requestCode == HyperWebViewManager.UPI_REQUEST_CODE) {
41-
HyperWebViewManager.onActivityResult(requestCode, resultCode, data)
42-
}
38+
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
39+
super.onActivityResult(requestCode, resultCode, data)
40+
if (requestCode == HyperWebViewManager.UPI_REQUEST_CODE) {
41+
HyperWebViewManager.onActivityResult(requestCode, resultCode, data)
4342
}
43+
}
4444
```
4545

46-
And then you can just start using it in react.
46+
### iOS
47+
48+
Add URI schemes for required UPI apps in `Info.plist`:
49+
50+
```plist
51+
<key>LSApplicationQueriesSchemes</key>
52+
<array>
53+
<string>credpay</string>
54+
<string>phonepe</string>
55+
<string>paytmmp</string>
56+
<string>tez</string>
57+
<string>paytm</string>
58+
<string>bhim</string>
59+
<string>myairtel</string>
60+
</array>
61+
```
62+
63+
Run `pod install` inside the iOS folder of your app.
64+
65+
### React Native
66+
67+
You can start using the component in your React Native app:
4768

4869
```js
4970
import HyperWebView from 'hyper-sdk-react-webview';
5071

51-
// ...
52-
5372
const MyWebComponent = () => {
54-
return <HyperWebView source={{ uri: 'https://reactnative.dev/' }} style={{ flex: 1 }} iframeIntegration={ false } />;
73+
return <HyperWebView source={{ uri: 'https://reactnative.dev/' }} style={{ flex: 1 }} iframeIntegration={false} />;
5574
}
5675
```
5776

5877
## How it works
5978

60-
With this package we have basically created a very thin wrapper around the `WebView` component provided by [react-native-webview](https://www.npmjs.com/package/react-native-webview). For `Android`, one can extend their view manager implementation & override the functionality as needed. After which the new class will have to be made available as a react-native component.
79+
This package provides a thin wrapper around the `WebView` component from [react-native-webview](https://www.npmjs.com/package/react-native-webview). For Android, you can extend the view manager implementation and override functionality as needed. The new class must then be made available as a React Native component.
6180

62-
For a more detailed walk-through you can visit their docs: [Custom-Android.md](https://github.com/react-native-webview/react-native-webview/blob/v13.10.2/docs/Custom-Android.md)
81+
For a detailed walk-through, refer to their documentation: [Custom-Android.md](https://github.com/react-native-webview/react-native-webview/blob/v13.10.2/docs/Custom-Android.md).
6382

6483
## License
6584

6685
MIT
6786

6887
---
6988

70-
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
89+
Created with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)

0 commit comments

Comments
 (0)