pa-sdk-react-native 3.0.2 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -12
- package/example/App.tsx +583 -0
- package/example/README.md +105 -0
- package/example/android/app/build.gradle +130 -0
- package/example/android/app/debug.keystore +0 -0
- package/example/android/app/proguard-rules.pro +10 -0
- package/example/android/app/src/debug/AndroidManifest.xml +9 -0
- package/example/android/app/src/main/AndroidManifest.xml +26 -0
- package/example/android/app/src/main/java/com/pademo/MainActivity.kt +22 -0
- package/example/android/app/src/main/java/com/pademo/MainApplication.kt +45 -0
- package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/values/strings.xml +3 -0
- package/example/android/app/src/main/res/values/styles.xml +9 -0
- package/example/android/build.gradle +21 -0
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/example/android/gradle.properties +39 -0
- package/example/android/gradlew +251 -0
- package/example/android/gradlew.bat +94 -0
- package/example/android/settings.gradle +8 -0
- package/example/app.json +4 -0
- package/example/index.js +4 -0
- package/example/ios/.xcode.env +11 -0
- package/example/ios/.xcode.env.local +1 -0
- package/example/ios/PaSdkExample/AppDelegate.swift +111 -0
- package/example/ios/PaSdkExample/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/example/ios/PaSdkExample/Images.xcassets/Contents.json +6 -0
- package/example/ios/PaSdkExample/Info.plist +81 -0
- package/example/ios/PaSdkExample/LaunchScreen.storyboard +47 -0
- package/example/ios/PaSdkExample/PrivacyInfo.xcprivacy +37 -0
- package/example/ios/PaSdkExample.xcodeproj/project.pbxproj +468 -0
- package/example/ios/PaSdkExample.xcodeproj/xcshareddata/xcschemes/PaSdkExample.xcscheme +88 -0
- package/example/ios/PaSdkExample.xcworkspace/contents.xcworkspacedata +10 -0
- package/example/ios/Podfile +39 -0
- package/example/ios/Podfile.lock +1990 -0
- package/example/metro.config.js +17 -0
- package/example/package.json +29 -0
- package/example/patches/react-native+0.79.0.patch +215 -0
- package/lib/api.d.ts +3 -0
- package/lib/api.js +9 -2
- package/lib/confirm.js +78 -32
- package/lib/locales.generated.js +108 -4
- package/locales/en-US.json +27 -1
- package/locales/ms-MY.json +27 -1
- package/locales/zh-CN.json +27 -1
- package/locales/zh-TW.json +27 -1
- package/native/ios/PaSdk3ds.swift +3 -2
- package/native/ios/PaSdk3dsModule.m +2 -1
- package/package.json +10 -2
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# PA SDK React Native — example app
|
|
2
|
+
|
|
3
|
+
A minimal React Native app exercising every core flow: one-off payment,
|
|
4
|
+
save during payment, manual save ($0 verification), saved-card reuse, 3DS
|
|
5
|
+
challenge + cancel, app-switch return, and multi-market accounts.
|
|
6
|
+
|
|
7
|
+
Runs with the **New Architecture enabled** — `newArchEnabled=true` in
|
|
8
|
+
`android/gradle.properties` (Hermes on), and the RN 0.79 default on iOS.
|
|
9
|
+
The SDK's classic-bridge 3DS module runs through RN's interop layer.
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# from the package root (one level up)
|
|
15
|
+
cd ..
|
|
16
|
+
npm install # builds devDependencies for the library itself
|
|
17
|
+
|
|
18
|
+
# example app
|
|
19
|
+
cd example
|
|
20
|
+
npm install # installs react-native 0.79 + links the library via file:..
|
|
21
|
+
|
|
22
|
+
cd ios && pod install && cd .. # iOS: install the React pods + autolinked PaSdk3ds pod
|
|
23
|
+
# Android: autolinking picks up ../native/android — no extra step.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Run it:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm run ios # or: open ios/PaSdkExample.xcworkspace in Xcode and Run
|
|
30
|
+
npm run android
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
iOS project notes:
|
|
34
|
+
|
|
35
|
+
- `example/ios/` is the standard RN 0.79 CLI template (Swift
|
|
36
|
+
`AppDelegate`, factory-based launch), generated for app name
|
|
37
|
+
`PaSdkExample` with bundle id `com.pasdk.example`.
|
|
38
|
+
- The 3DS app-switch return scheme (`flow`) is registered in
|
|
39
|
+
`Info.plist` (`CFBundleURLTypes`) to match `threeDsReturnUrls.scheme`
|
|
40
|
+
in `App.tsx`. The universal-link host (`app.flowtheroom.com`) needs an
|
|
41
|
+
associated-domains entitlement + AASA on the domain — the custom scheme
|
|
42
|
+
is enough locally.
|
|
43
|
+
- `AppDelegate.swift` gives the SDK first refusal on every incoming URL
|
|
44
|
+
(`PaSdk3ds.handleReturnUrl`, per the package README's "iOS app-switch
|
|
45
|
+
returns"): a URL matching the pending 3DS challenge is consumed by the
|
|
46
|
+
SDK and ignored by the app; anything else is logged. The JS side does
|
|
47
|
+
the same via the `handleReturnUrl` wrapper in the `Linking` listener in
|
|
48
|
+
`App.tsx`.
|
|
49
|
+
- After changing native deps, re-run `pod install`.
|
|
50
|
+
|
|
51
|
+
## Using the app
|
|
52
|
+
|
|
53
|
+
1. Pick the **environment** (`sandbox` — the default — or `production`).
|
|
54
|
+
Toggling re-inits the SDK and switches the gateway host the demo mint
|
|
55
|
+
uses.
|
|
56
|
+
2. Tap **1. init** — initialises the SDK with the two merchant accounts
|
|
57
|
+
(HK + MY), a locale, and the `threeDsReturnUrls` consumed by the SDK.
|
|
58
|
+
3. Pick the **locale** (`en_US`, `zh_HK`, `zh_CN`, `my_MY`) and the
|
|
59
|
+
**market** — the market selects the merchant account per call.
|
|
60
|
+
4. Pick a **flow**:
|
|
61
|
+
- **One-off payment** — mints a Sale intent; `confirmWithCard` pays it.
|
|
62
|
+
- **Save during payment** — Sale intent + `saveCard: true`;
|
|
63
|
+
`pa_token`, brand and last4 return with the payment result.
|
|
64
|
+
- **Manual save ($0 verify)** — mints a **$0 verification intent**
|
|
65
|
+
(`amount: "0"`; the gateway treats amount=0 as card-setup
|
|
66
|
+
verification, nothing is charged) and confirms it with
|
|
67
|
+
`saveCard: true`.
|
|
68
|
+
- **Saved-card reuse** — mints a normal Sale intent, then confirms it
|
|
69
|
+
with a pa_token saved earlier (`confirmWithToken`). Run a save flow
|
|
70
|
+
or step 4a first; the button is disabled until a token exists.
|
|
71
|
+
5. Paste `intent_token` + `client_token` minted by **your** server, or
|
|
72
|
+
press **Mint demo intent** (needs a test API key in `App.tsx`). For
|
|
73
|
+
manual save the mint ignores the amount field and uses `0`.
|
|
74
|
+
6. Run the selected flow with the **3./4a./4b.** buttons:
|
|
75
|
+
- **3.** the flow's primary action (combined `confirmWithCard`, or
|
|
76
|
+
`confirmWithToken` for saved-card reuse),
|
|
77
|
+
- **4a. Tokenize** then **4b. Confirm with token** — the mandatory
|
|
78
|
+
two-step form (`tokenizeCard` -> `confirmWithToken`).
|
|
79
|
+
7. **Idempotency (retry-safe)**: the key shown under "Idempotency" is
|
|
80
|
+
stable for one logical attempt — pressing a flow button again re-sends
|
|
81
|
+
the same key and the gateway returns the stored result instead of
|
|
82
|
+
double-charging. A new attempt (a fresh **Mint demo intent** or
|
|
83
|
+
**Start new attempt**) regenerates it.
|
|
84
|
+
8. **3DS**: when the gateway answers `requires_action`, the SDK presents
|
|
85
|
+
the full-screen challenge itself; `onThreeDsWillPresent` fires first
|
|
86
|
+
(dismiss your loading overlay then — the app shows a hint banner).
|
|
87
|
+
- **Cancel path**: tap the challenge screen's own **Cancel** button
|
|
88
|
+
(top-right, SDK chrome) — the result comes back as `cancelled`.
|
|
89
|
+
- **Approve path**: approve in a banking app and return; the SDK
|
|
90
|
+
consumes the return URL (`flow://` or the universal-link host) via
|
|
91
|
+
`handleReturnUrl` (called first by iOS `AppDelegate` and by the
|
|
92
|
+
`Linking` listener in `App.tsx`) and keeps polling. Non-3DS URLs
|
|
93
|
+
the app receives are logged and shown. Polling budget exhausted
|
|
94
|
+
with no answer resolves `processing`, never `failed`.
|
|
95
|
+
9. **Errors**: a decline shows PA's localized user message in the selected
|
|
96
|
+
locale and the code is visible in the result panel.
|
|
97
|
+
|
|
98
|
+
## Tokens for local testing
|
|
99
|
+
|
|
100
|
+
`example/App.tsx` has `MERCHANT_TOKENS` placeholders — put your sandbox
|
|
101
|
+
publishable merchant tokens there. The intent credentials must come from a
|
|
102
|
+
server call (`POST /{merchantToken}/payment-intent` with your secret key);
|
|
103
|
+
there is no in-app intent creation by design. Point the fields at any
|
|
104
|
+
intent your backend creates against the PA sandbox, then press a flow
|
|
105
|
+
button.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
apply plugin: "com.android.application"
|
|
2
|
+
apply plugin: "org.jetbrains.kotlin.android"
|
|
3
|
+
apply plugin: "com.facebook.react"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This is the configuration block to customize your React Native Android app.
|
|
7
|
+
* By default you don't need to apply any configuration, just uncomment the lines you need.
|
|
8
|
+
*/
|
|
9
|
+
react {
|
|
10
|
+
/* Folders */
|
|
11
|
+
// The root of your project, i.e. where "package.json" lives. Default is '../..'
|
|
12
|
+
// root = file("../../")
|
|
13
|
+
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
|
|
14
|
+
// reactNativeDir = file("../../node_modules/react-native")
|
|
15
|
+
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
|
|
16
|
+
// codegenDir = file("../../node_modules/@react-native/codegen")
|
|
17
|
+
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
|
|
18
|
+
// cliFile = file("../../node_modules/react-native/cli.js")
|
|
19
|
+
|
|
20
|
+
/* Variants */
|
|
21
|
+
// The list of variants to that are debuggable. For those we're going to
|
|
22
|
+
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
|
|
23
|
+
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
|
24
|
+
// debuggableVariants = ["liteDebug", "prodDebug"]
|
|
25
|
+
|
|
26
|
+
/* Bundling */
|
|
27
|
+
// A list containing the node command and its flags. Default is just 'node'.
|
|
28
|
+
// nodeExecutableAndArgs = ["node"]
|
|
29
|
+
//
|
|
30
|
+
// The command to run when bundling. By default is 'bundle'
|
|
31
|
+
// bundleCommand = "ram-bundle"
|
|
32
|
+
//
|
|
33
|
+
// The path to the CLI configuration file. Default is empty.
|
|
34
|
+
// bundleConfig = file(../rn-cli.config.js)
|
|
35
|
+
//
|
|
36
|
+
// The name of the generated asset file containing your JS bundle
|
|
37
|
+
// bundleAssetName = "MyApplication.android.bundle"
|
|
38
|
+
//
|
|
39
|
+
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
|
|
40
|
+
// entryFile = file("../js/MyApplication.android.js")
|
|
41
|
+
//
|
|
42
|
+
// A list of extra flags to pass to the 'bundle' commands.
|
|
43
|
+
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
|
|
44
|
+
// extraPackagerArgs = []
|
|
45
|
+
|
|
46
|
+
/* Hermes Commands */
|
|
47
|
+
// The hermes compiler command to run. By default it is 'hermesc'
|
|
48
|
+
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
|
|
49
|
+
//
|
|
50
|
+
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
|
|
51
|
+
// hermesFlags = ["-O", "-output-source-map"]
|
|
52
|
+
|
|
53
|
+
/* Autolinking */
|
|
54
|
+
autolinkLibrariesWithApp()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
|
|
59
|
+
*/
|
|
60
|
+
def enableProguardInReleaseBuilds = false
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The preferred build flavor of JavaScriptCore (JSC)
|
|
64
|
+
*
|
|
65
|
+
* For example, to use the international variant, you can use:
|
|
66
|
+
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
|
|
67
|
+
*
|
|
68
|
+
* The international variant includes ICU i18n library and necessary data
|
|
69
|
+
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
|
70
|
+
* give correct results when using with locales other than en-US. Note that
|
|
71
|
+
* this variant is about 6MiB larger per architecture than default.
|
|
72
|
+
*/
|
|
73
|
+
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
|
|
74
|
+
|
|
75
|
+
android {
|
|
76
|
+
ndkVersion rootProject.ext.ndkVersion
|
|
77
|
+
buildToolsVersion rootProject.ext.buildToolsVersion
|
|
78
|
+
compileSdk rootProject.ext.compileSdkVersion
|
|
79
|
+
|
|
80
|
+
namespace "com.pademo"
|
|
81
|
+
defaultConfig {
|
|
82
|
+
applicationId "com.pademo"
|
|
83
|
+
minSdkVersion rootProject.ext.minSdkVersion
|
|
84
|
+
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
85
|
+
versionCode 1
|
|
86
|
+
versionName "1.0"
|
|
87
|
+
// 3DS return URLs for the SDK's challenge activity (must match the
|
|
88
|
+
// threeDsReturnUrls passed to init() in App.tsx).
|
|
89
|
+
manifestPlaceholders = [
|
|
90
|
+
paSdk3dsReturnScheme: "flow",
|
|
91
|
+
paSdk3dsReturnHost: "app.flowtheroom.com"
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
signingConfigs {
|
|
95
|
+
debug {
|
|
96
|
+
storeFile file('debug.keystore')
|
|
97
|
+
storePassword 'android'
|
|
98
|
+
keyAlias 'androiddebugkey'
|
|
99
|
+
keyPassword 'android'
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
buildTypes {
|
|
103
|
+
debug {
|
|
104
|
+
signingConfig signingConfigs.debug
|
|
105
|
+
}
|
|
106
|
+
release {
|
|
107
|
+
// Caution! In production, you need to generate your own keystore file.
|
|
108
|
+
// see https://reactnative.dev/docs/signed-apk-android.
|
|
109
|
+
signingConfig signingConfigs.debug
|
|
110
|
+
minifyEnabled enableProguardInReleaseBuilds
|
|
111
|
+
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
dependencies {
|
|
117
|
+
// The version of react-native is set by the React Native Gradle Plugin
|
|
118
|
+
implementation("com.facebook.react:react-android")
|
|
119
|
+
|
|
120
|
+
// PASDK native module (3DS activity + legacy-bridge package); registered
|
|
121
|
+
// manually in MainApplication.getPackages() because the SDK's library
|
|
122
|
+
// build.gradle does not carry RN autolinking metadata.
|
|
123
|
+
implementation project(':pasdk-react-native')
|
|
124
|
+
|
|
125
|
+
if (hermesEnabled.toBoolean()) {
|
|
126
|
+
implementation("com.facebook.react:hermes-android")
|
|
127
|
+
} else {
|
|
128
|
+
implementation jscFlavor
|
|
129
|
+
}
|
|
130
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Add project specific ProGuard rules here.
|
|
2
|
+
# By default, the flags in this file are appended to flags specified
|
|
3
|
+
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
|
|
4
|
+
# You can edit the include path and order by changing the proguardFiles
|
|
5
|
+
# directive in build.gradle.
|
|
6
|
+
#
|
|
7
|
+
# For more details, see
|
|
8
|
+
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
9
|
+
|
|
10
|
+
# Add any project specific keep options here:
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
xmlns:tools="http://schemas.android.com/tools">
|
|
4
|
+
|
|
5
|
+
<application
|
|
6
|
+
android:usesCleartextTraffic="true"
|
|
7
|
+
tools:targetApi="28"
|
|
8
|
+
tools:ignore="GoogleAppIndexingWarning"/>
|
|
9
|
+
</manifest>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
|
+
|
|
3
|
+
<uses-permission android:name="android.permission.INTERNET" />
|
|
4
|
+
|
|
5
|
+
<application
|
|
6
|
+
android:name=".MainApplication"
|
|
7
|
+
android:label="@string/app_name"
|
|
8
|
+
android:icon="@mipmap/ic_launcher"
|
|
9
|
+
android:roundIcon="@mipmap/ic_launcher_round"
|
|
10
|
+
android:allowBackup="false"
|
|
11
|
+
android:theme="@style/AppTheme"
|
|
12
|
+
android:supportsRtl="true">
|
|
13
|
+
<activity
|
|
14
|
+
android:name=".MainActivity"
|
|
15
|
+
android:label="@string/app_name"
|
|
16
|
+
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
|
|
17
|
+
android:launchMode="singleTask"
|
|
18
|
+
android:windowSoftInputMode="adjustResize"
|
|
19
|
+
android:exported="true">
|
|
20
|
+
<intent-filter>
|
|
21
|
+
<action android:name="android.intent.action.MAIN" />
|
|
22
|
+
<category android:name="android.intent.category.LAUNCHER" />
|
|
23
|
+
</intent-filter>
|
|
24
|
+
</activity>
|
|
25
|
+
</application>
|
|
26
|
+
</manifest>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.pademo
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactActivity
|
|
4
|
+
import com.facebook.react.ReactActivityDelegate
|
|
5
|
+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
|
|
6
|
+
import com.facebook.react.defaults.DefaultReactActivityDelegate
|
|
7
|
+
|
|
8
|
+
class MainActivity : ReactActivity() {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns the name of the main component registered from JavaScript. This is used to schedule
|
|
12
|
+
* rendering of the component.
|
|
13
|
+
*/
|
|
14
|
+
override fun getMainComponentName(): String = "PaSdkExample"
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
|
|
18
|
+
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
|
|
19
|
+
*/
|
|
20
|
+
override fun createReactActivityDelegate(): ReactActivityDelegate =
|
|
21
|
+
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
|
|
22
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
package com.pademo
|
|
2
|
+
|
|
3
|
+
import android.app.Application
|
|
4
|
+
import com.facebook.react.PackageList
|
|
5
|
+
import com.facebook.react.ReactApplication
|
|
6
|
+
import com.facebook.react.ReactHost
|
|
7
|
+
import com.facebook.react.ReactNativeHost
|
|
8
|
+
import com.facebook.react.ReactPackage
|
|
9
|
+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
|
|
10
|
+
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
|
|
11
|
+
import com.facebook.react.defaults.DefaultReactNativeHost
|
|
12
|
+
import com.facebook.react.soloader.OpenSourceMergedSoMapping
|
|
13
|
+
import com.facebook.soloader.SoLoader
|
|
14
|
+
|
|
15
|
+
class MainApplication : Application(), ReactApplication {
|
|
16
|
+
|
|
17
|
+
override val reactNativeHost: ReactNativeHost =
|
|
18
|
+
object : DefaultReactNativeHost(this) {
|
|
19
|
+
override fun getPackages(): List<ReactPackage> =
|
|
20
|
+
PackageList(this).packages.apply {
|
|
21
|
+
// Packages that cannot be autolinked yet can be added manually here, for example:
|
|
22
|
+
// add(MyReactNativePackage())
|
|
23
|
+
add(com.pasdk.reactnative.PaSdkReactNativePackage())
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
override fun getJSMainModuleName(): String = "index"
|
|
27
|
+
|
|
28
|
+
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
|
|
29
|
+
|
|
30
|
+
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
31
|
+
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override val reactHost: ReactHost
|
|
35
|
+
get() = getDefaultReactHost(applicationContext, reactNativeHost)
|
|
36
|
+
|
|
37
|
+
override fun onCreate() {
|
|
38
|
+
super.onCreate()
|
|
39
|
+
SoLoader.init(this, OpenSourceMergedSoMapping)
|
|
40
|
+
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
41
|
+
// If you opted-in for the New Architecture, we load the native entry point for this app.
|
|
42
|
+
load()
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Copyright (C) 2014 The Android Open Source Project
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
-->
|
|
16
|
+
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
|
17
|
+
android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
|
|
18
|
+
android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
|
|
19
|
+
android:insetTop="@dimen/abc_edit_text_inset_top_material"
|
|
20
|
+
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"
|
|
21
|
+
>
|
|
22
|
+
|
|
23
|
+
<selector>
|
|
24
|
+
<!--
|
|
25
|
+
This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
|
|
26
|
+
The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
|
|
27
|
+
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
|
|
28
|
+
|
|
29
|
+
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
|
|
30
|
+
|
|
31
|
+
For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
|
|
32
|
+
-->
|
|
33
|
+
<item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
|
|
34
|
+
<item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
|
|
35
|
+
</selector>
|
|
36
|
+
|
|
37
|
+
</inset>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<resources>
|
|
2
|
+
|
|
3
|
+
<!-- Base application theme. -->
|
|
4
|
+
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
|
5
|
+
<!-- Customize your theme here. -->
|
|
6
|
+
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
|
|
7
|
+
</style>
|
|
8
|
+
|
|
9
|
+
</resources>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext {
|
|
3
|
+
buildToolsVersion = "35.0.0"
|
|
4
|
+
minSdkVersion = 24
|
|
5
|
+
compileSdkVersion = 35
|
|
6
|
+
targetSdkVersion = 35
|
|
7
|
+
ndkVersion = "27.1.12297006"
|
|
8
|
+
kotlinVersion = "2.0.21"
|
|
9
|
+
}
|
|
10
|
+
repositories {
|
|
11
|
+
google()
|
|
12
|
+
mavenCentral()
|
|
13
|
+
}
|
|
14
|
+
dependencies {
|
|
15
|
+
classpath("com.android.tools.build:gradle")
|
|
16
|
+
classpath("com.facebook.react:react-native-gradle-plugin")
|
|
17
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
apply plugin: "com.facebook.react.rootproject"
|
|
Binary file
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Project-wide Gradle settings.
|
|
2
|
+
|
|
3
|
+
# IDE (e.g. Android Studio) users:
|
|
4
|
+
# Gradle settings configured through the IDE *will override*
|
|
5
|
+
# any settings specified in this file.
|
|
6
|
+
|
|
7
|
+
# For more details on how to configure your build environment visit
|
|
8
|
+
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
|
9
|
+
|
|
10
|
+
# Specifies the JVM arguments used for the daemon process.
|
|
11
|
+
# The setting is particularly useful for tweaking memory settings.
|
|
12
|
+
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
|
|
13
|
+
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
|
|
14
|
+
|
|
15
|
+
# When configured, Gradle will run in incubating parallel mode.
|
|
16
|
+
# This option should only be used with decoupled projects. More details, visit
|
|
17
|
+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
|
18
|
+
# org.gradle.parallel=true
|
|
19
|
+
|
|
20
|
+
# AndroidX package structure to make it clearer which packages are bundled with the
|
|
21
|
+
# Android operating system, and which are packaged with your app's APK
|
|
22
|
+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
|
23
|
+
android.useAndroidX=true
|
|
24
|
+
|
|
25
|
+
# Use this property to specify which architecture you want to build.
|
|
26
|
+
# You can also override it from the CLI using
|
|
27
|
+
# ./gradlew <task> -PreactNativeArchitectures=x86_64
|
|
28
|
+
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
|
|
29
|
+
|
|
30
|
+
# Use this property to enable support to the new architecture.
|
|
31
|
+
# This will allow you to use TurboModules and the Fabric render in
|
|
32
|
+
# your application. You should enable this flag either if you want
|
|
33
|
+
# to write custom TurboModules/Fabric components OR use libraries that
|
|
34
|
+
# are providing them.
|
|
35
|
+
newArchEnabled=true
|
|
36
|
+
|
|
37
|
+
# Use this property to enable or disable the Hermes JS engine.
|
|
38
|
+
# If set to false, you will be using JSC instead.
|
|
39
|
+
hermesEnabled=true
|