From 38e91c5909d2ff6502b1ca0c358e6fb3c06bf2ac Mon Sep 17 00:00:00 2001 From: Kyle Giannini Date: Mon, 20 May 2024 14:44:47 -0700 Subject: [PATCH] Update Apple Pay Button type options to fit AppFolio's needs --- ios/Views/PKPaymentButtonView.m | 8 +++----- js/PKPaymentButton/index.js | 31 ++++++++++++++----------------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/ios/Views/PKPaymentButtonView.m b/ios/Views/PKPaymentButtonView.m index 0eeaea9d..d79842f1 100644 --- a/ios/Views/PKPaymentButtonView.m +++ b/ios/Views/PKPaymentButtonView.m @@ -64,14 +64,12 @@ - (void)setButtonType:(NSString *) buttonType andStyle:(NSString *) buttonStyle PKPaymentButtonType type; PKPaymentButtonStyle style; - if ([buttonType isEqualToString: @"buy"]) { - type = PKPaymentButtonTypeBuy; - } else if ([buttonType isEqualToString: @"setUp"]) { + if ([buttonType isEqualToString: @"setUp"]) { type = PKPaymentButtonTypeSetUp; + } else if ([buttonType isEqualToString: @"continue"]) { + type = PKPaymentButtonTypeContinue; } else if ([buttonType isEqualToString: @"inStore"]) { type = PKPaymentButtonTypeInStore; - } else if ([buttonType isEqualToString: @"donate"]) { - type = PKPaymentButtonTypeDonate; } else { type = PKPaymentButtonTypePlain; } diff --git a/js/PKPaymentButton/index.js b/js/PKPaymentButton/index.js index 5e008a6a..f2dc6f9d 100644 --- a/js/PKPaymentButton/index.js +++ b/js/PKPaymentButton/index.js @@ -1,27 +1,25 @@ // @flow -import * as React from 'react'; -import { NativeModules, requireNativeComponent } from 'react-native'; +import * as React from "react"; +import { NativeModules, requireNativeComponent } from "react-native"; type PKPaymentButtonType = // A button with the Apple Pay logo only. - | 'plain' - // A button with the text “Buy with” and the Apple Pay logo. - | 'buy' - // A button prompting the user to set up a card. - | 'setUp' + | "plain" + // A button with the text “Set up” and the Apple Pay logo. + | "setUp" + // A button with the text “Continue with” and the Apple Pay logo. + | "continue" // A button with the text “Pay with” and the Apple Pay logo. - | 'inStore' - // A button with the text "Donate with" and the Apple Pay logo. - | 'donate'; + | "inStore"; type PKPaymentButtonStyle = // A white button with black lettering (shown here against a gray background to ensure visibility). - | 'white' + | "white" // A white button with black lettering and a black outline. - | 'whiteOutline' + | "whiteOutline" // A black button with white lettering. - | 'black'; + | "black"; type Props = $Exact<{ style: ButtonStyle, @@ -32,18 +30,17 @@ type Props = $Exact<{ onPress: Function, }>; -const RNPKPaymentButton = requireNativeComponent('PKPaymentButton', null, { +const RNPKPaymentButton = requireNativeComponent("PKPaymentButton", null, { nativeOnly: { onPress: true }, }); - export type ButtonType = PKPaymentButtonType; export type ButtonStyle = PKPaymentButtonStyle; export class PKPaymentButton extends React.Component { static defaultProps = { - buttonStyle: 'black', - buttonType: 'plain', + buttonStyle: "black", + buttonType: "plain", height: 44, cornerRadius: 4, };