File tree 4 files changed +54
-7
lines changed
android/src/main/java/com/reactnativepayments
4 files changed +54
-7
lines changed Original file line number Diff line number Diff line change
1
+ package com .reactnativepayments ;
2
+
3
+ import android .content .Context ;
4
+ import android .view .LayoutInflater ;
5
+ import android .view .View ;
6
+ import android .widget .RelativeLayout ;
7
+
8
+ /**
9
+ * Image of Google Pay Button (buy_with_googlepay_button)
10
+ * see https://developers.google.com/pay/api/android/guides/brand-guidelines
11
+ */
12
+ public class GooglePayImage extends RelativeLayout {
13
+
14
+ public GooglePayImage (Context context ) {
15
+ super (context );
16
+
17
+ View view = LayoutInflater .from (getContext ()).inflate (
18
+ R .layout .buy_with_googlepay_button , null );
19
+
20
+ this .addView (view );
21
+ }
22
+
23
+
24
+ }
Original file line number Diff line number Diff line change
1
+ package com .reactnativepayments ;
2
+
3
+ import android .view .LayoutInflater ;
4
+ import android .view .View ;
5
+
6
+ import com .facebook .react .uimanager .SimpleViewManager ;
7
+ import com .facebook .react .uimanager .ThemedReactContext ;
8
+
9
+ public class GooglePayImageManager extends SimpleViewManager <View > {
10
+
11
+ public static final String REACT_CLASS = "GooglePayImageView" ;
12
+
13
+ @ Override
14
+ public String getName () {
15
+ return REACT_CLASS ;
16
+ }
17
+
18
+ @ Override
19
+ protected View createViewInstance (ThemedReactContext reactContext ) {
20
+ return LayoutInflater .from (reactContext ).inflate (
21
+ R .layout .buy_with_googlepay_button , null );
22
+ }
23
+ }
Original file line number Diff line number Diff line change 10
10
import com .facebook .react .bridge .ReactApplicationContext ;
11
11
import com .facebook .react .uimanager .ViewManager ;
12
12
import com .facebook .react .bridge .JavaScriptModule ;
13
+
13
14
public class ReactNativePaymentsPackage implements ReactPackage {
14
15
@ Override
15
16
public List <NativeModule > createNativeModules (ReactApplicationContext reactContext ) {
16
17
return Arrays .<NativeModule >asList (new ReactNativePaymentsModule (reactContext ));
17
18
}
18
19
19
- // Deprecated RN 0.47
20
- public List <Class <? extends JavaScriptModule >> createJSModules () {
21
- return Collections .emptyList ();
22
- }
23
-
24
20
@ Override
25
21
public List <ViewManager > createViewManagers (ReactApplicationContext reactContext ) {
26
- return Collections .emptyList ();
22
+ return Collections .<ViewManager >singletonList (
23
+ new GooglePayImageManager ()
24
+ );
27
25
}
28
26
}
Original file line number Diff line number Diff line change 1
1
// @flow
2
+ import { requireNativeComponent } from 'react-native' ;
2
3
3
4
import _PaymentRequest from './PaymentRequest' ;
4
5
import _NativePayments from './NativePayments' ;
5
6
import { PKPaymentButton } from './PKPaymentButton' ;
6
7
7
8
export const ApplePayButton = PKPaymentButton ;
8
9
export const PaymentRequest = _PaymentRequest ;
9
- export const canMakePayments = _NativePayments . canMakePayments ;
10
+ export const canMakePayments = _NativePayments . canMakePayments ;
11
+ export const GooglePayButton = requireNativeComponent ( 'GooglePayImageView' )
You can’t perform that action at this time.
0 commit comments