Skip to main content

Button components

Native payment buttons: ApplePayButton (iOS) and GooglePayButton (Android). Use the one that matches the platform; the library does not render both on the same screen.

ApplePayButton (iOS only)

Renders the system Apple Pay button. Only available on iOS.

Props

PropTypeRequiredDescription
buttonTypeApplePayButtonTypeYesButton label type.
buttonStyleApplePayButtonStyleYesVisual style.
onPress() => voidNoCalled when the user taps the button.
styleViewStyleNoLayout/style (e.g. width, height).

ApplePayButtonType:
'buy' | 'setUp' | 'book' | 'donate' | 'continue' | 'reload' | 'addMoney' | 'topUp' | 'order' | 'rent' | 'support' | 'contribute' | 'tip'

ApplePayButtonStyle:
'white' | 'whiteOutline' | 'black'

Example

import { ApplePayButton } from '@gmisoftware/react-native-pay'

<ApplePayButton
buttonType="buy"
buttonStyle="black"
onPress={handlePayment}
style={{ width: '100%', height: 48 }}
/>

Nitro and onPress

If onPress does not fire, use Nitro's callback(...) wrapper. See Troubleshooting: Nitro callback for onPress.


GooglePayButton (Android only)

Renders the Google Pay button. Only available on Android.

Props

PropTypeRequiredDescription
buttonTypeGooglePayButtonTypeYesButton label type.
theme'dark' | 'light'YesButton theme.
radiusnumberNoCorner radius in dp.
onPress() => voidNoCalled when the user taps the button.
styleViewStyleNoLayout/style (e.g. width, height).

GooglePayButtonType:
'buy' | 'book' | 'checkout' | 'donate' | 'order' | 'pay' | 'subscribe' | 'plain'

Example

import { GooglePayButton } from '@gmisoftware/react-native-pay'

<GooglePayButton
buttonType="buy"
theme="dark"
radius={8}
onPress={handlePayment}
style={{ width: '100%', height: 48 }}
/>

Nitro and onPress

Same as Apple: if needed, use callback(handlePayment) for onPress. See Troubleshooting: Nitro callback for onPress.


Platform-specific usage

Render one button per platform:

import { Platform } from 'react-native'
import { ApplePayButton, GooglePayButton } from '@gmisoftware/react-native-pay'

{Platform.OS === 'ios' ? (
<ApplePayButton buttonType="buy" buttonStyle="black" onPress={handlePay} style={styles.button} />
) : (
<GooglePayButton buttonType="buy" theme="dark" onPress={handlePay} style={styles.button} />
)}

Next