@rnw-community/react-native-payments 0.75.0 → 0.75.2
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/package.json +2 -2
- package/readme.md +26 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnw-community/react-native-payments",
|
|
3
|
-
"version": "0.75.
|
|
3
|
+
"version": "0.75.2",
|
|
4
4
|
"description": "React Native Payments",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"build:android": "cd example/android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
|
|
74
74
|
"build:ios": "cd example/ios && xcodebuild -workspace PaymentsExample.xcworkspace -scheme PaymentsExample -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "cd48c2bd986c7aef05828c6964c40c95f7792726",
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@rnw-community/shared": "0.75.0",
|
|
79
79
|
"react-native-uuid": "^2.0.1",
|
package/readme.md
CHANGED
|
@@ -248,6 +248,32 @@ payment process or when specific conditions require the payment request to be ab
|
|
|
248
248
|
|
|
249
249
|
> This will have no affect in the Android platform due to AndroidPay implementation.
|
|
250
250
|
|
|
251
|
+
|
|
252
|
+
## Unit testing
|
|
253
|
+
Due to new TurboModules architecture in React Native, you can [encounter issues](https://github.com/rnw-community/rnw-community/issues/227) with Jest tests. To fix this, you can mock
|
|
254
|
+
the TurboModuleRegistry to disable the `Payment` module in Jest tests. Here is an example of how you can do this:
|
|
255
|
+
|
|
256
|
+
```ts
|
|
257
|
+
const turboModuleRegistry = jest.requireActual(
|
|
258
|
+
'react-native/Libraries/TurboModule/TurboModuleRegistry'
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
/** HINT: Mock TurboModuleRegistry to disable the `Payment` module in Jest tests */
|
|
262
|
+
export function setupJestTurboModuleMock(): void {
|
|
263
|
+
jest.mock('react-native/Libraries/TurboModule/TurboModuleRegistry', () => {
|
|
264
|
+
return {
|
|
265
|
+
...turboModuleRegistry,
|
|
266
|
+
getEnforcing: (name: string) => {
|
|
267
|
+
if (name === 'Payment') {
|
|
268
|
+
return null; // Return null to mock the Payment module
|
|
269
|
+
}
|
|
270
|
+
return turboModuleRegistry.getEnforcing(name);
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
251
277
|
## Example
|
|
252
278
|
|
|
253
279
|
You can find working example in the `App` component of
|