|
1 | | -import React, { forwardRef, useEffect, useRef, useState } from 'react'; |
2 | | -import { |
3 | | - AccessibilityProps, |
4 | | - HostComponent, |
5 | | - LayoutAnimation, |
6 | | -} from 'react-native'; |
| 1 | +import React, { forwardRef, useEffect, useState } from 'react'; |
| 2 | +import { AccessibilityProps, LayoutAnimation } from 'react-native'; |
7 | 3 | import { |
8 | 4 | PaymentMethodMessagingElementAppearance, |
9 | 5 | PaymentMethodMessagingElementState, |
10 | 6 | } from '../types/components/PaymentMethodMessagingElementComponent'; |
11 | 7 | import { PaymentMethodMessagingElementConfiguration } from '../types/components/PaymentMethodMessagingElementComponent'; |
12 | | -import NativePaymentMethodMessagingElement, { |
13 | | - NativeProps, |
14 | | -} from '../specs/NativePaymentMethodMessagingElement'; |
| 8 | +import NativePaymentMethodMessagingElement from '../specs/NativePaymentMethodMessagingElement'; |
15 | 9 | import { addListener } from '../events'; |
16 | 10 |
|
17 | 11 | export interface Props extends AccessibilityProps { |
@@ -51,10 +45,7 @@ export interface Props extends AccessibilityProps { |
51 | 45 | * @category ReactComponents |
52 | 46 | */ |
53 | 47 | export const PaymentMethodMessagingElement = forwardRef<any, Props>( |
54 | | - ({ appearance, configuration, onStateChange, ...props }) => { |
55 | | - const viewRef = |
56 | | - useRef<React.ComponentRef<HostComponent<NativeProps>>>(null); |
57 | | - |
| 48 | + ({ appearance, configuration, onStateChange, ...props }, ref) => { |
58 | 49 | const [height, setHeight] = useState<number | undefined>(); |
59 | 50 |
|
60 | 51 | useEffect(() => { |
@@ -102,7 +93,7 @@ export const PaymentMethodMessagingElement = forwardRef<any, Props>( |
102 | 93 | style={[{ width: '100%', height: height }]} |
103 | 94 | configuration={configuration} |
104 | 95 | {...props} |
105 | | - ref={viewRef} |
| 96 | + ref={ref} |
106 | 97 | /> |
107 | 98 | ); |
108 | 99 | } |
|
0 commit comments