Skip to content

Commit e5a8809

Browse files
authored
feat(RNPSW): expose the root modal's props for customization (#174)
1 parent 418dabe commit e5a8809

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ function Pay(){
130130
| `autoStart` | Auto start payment once page is opened | default: `false` |
131131
| `refNumber` | Reference number, if you have already generated one | default: `''+Math.floor((Math.random() * 1000000000) + 1)` |
132132
| `handleWebViewMessage` | Will be called when a WebView receives a message | default: `true` |
133+
| `modalProps` | Can be used to extend the root modal props for example to handle closing like so `modalProps={{ onRequestClose: () => paystackWebViewRef.current.endTransaction() }}` | default: `nill` |
133134

134135

135136

development/paystack.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const Paystack: React.ForwardRefRenderFunction<React.ReactNode, PayStackProps> =
2727
autoStart = false,
2828
onSuccess,
2929
activityIndicatorColor = 'green',
30+
modalProps,
3031
},
3132
ref,
3233
) => {
@@ -160,7 +161,7 @@ const Paystack: React.ForwardRefRenderFunction<React.ReactNode, PayStackProps> =
160161
};
161162

162163
return (
163-
<Modal style={{ flex: 1 }} visible={showModal} animationType="slide" transparent={false}>
164+
<Modal style={{ flex: 1 }} visible={showModal} animationType="slide" transparent={false} {...modalProps}>
164165
<SafeAreaView style={{ flex: 1 }}>
165166
<WebView
166167
style={[{ flex: 1 }]}

development/types/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from 'react';
2+
import { ModalProps } from 'react-native';
23
export type Currency = 'NGN' | 'GHS' | 'USD' | 'ZAR';
34

45
export type PaymentChannels = 'bank' | 'card' | 'qr' | 'ussd' | 'mobile_money' | 'bank_transfer' | 'eft';
@@ -47,6 +48,7 @@ export interface PayStackProps {
4748
autoStart?: boolean;
4849
activityIndicatorColor?: string;
4950
ref: React.ReactElement;
51+
modalProps?: ModalProps;
5052
}
5153

5254
export interface PayStackRef {

0 commit comments

Comments
 (0)