RN android 에서만 겪는 초기화 이슈 문의드립니다. 비슷한 사례가 있었다면 어떻게 안내해주셨는지 궁금합니다.
https://github.com/tosspayments/tosspayments-sample-v1/blob/main/payment-widget/react-native/App.tsx
위 코드 App.tsx 참고해서 현재 ios 는 문제 없이 잘 작동합니다.
android에서만
{paymentWidgetControl && (
<PaymentMethodWidget
{paymentWidgetControl && (
<PaymentMethodWidget
selector="payment-methods"
onLoadEnd={async () => {
console.debug('
[PaymentMethodWidget] onLoadEnd 시작');
try {
// 여기서 코드가 멈춥니다~!
const control = await paymentWidgetControl.renderPaymentMethods(
'payment-methods',
{ value: TRAINER_MATCHING_PRICE, currency: 'KRW', country: 'KR' },
{ variantKey: 'DEFAULT' }
);
// 여기까지 안 오는 문제가 발생합니다.
// async await 는 시점 디버깅을 위해 추가했습니다. then 사용해도 동일하게 android 에서만 위 renderPaymentMethods 메소드가 동작하지 않습니다. 리소스 경쟁이 발생하는 건지, 교착상태에 빠진 걸로 보입니다.
console.debug('
renderPaymentMethods 완료:', control);
setPaymentMethodWidgetControl(control);
} catch (error: any) {
console.error('
renderPaymentMethods 오류:', JSON.stringify(error));
Alert.alert('결제 위젯 초기화 오류', error.message || JSON.stringify(error));
}
}}
/>
)}
코드 일 부분인데 주석으로 상세하게 이슈를 남겼습니다. 감사합니다.
위 코드 App.tsx 참고해서 현재 ios 는 문제 없이 잘 작동합니다.
android에서만
{paymentWidgetControl && (
<PaymentMethodWidget
{paymentWidgetControl && (
<PaymentMethodWidget
selector="payment-methods"
onLoadEnd={async () => {
console.debug('
try {
// 여기서 코드가 멈춥니다~!
const control = await paymentWidgetControl.renderPaymentMethods(
'payment-methods',
{ value: TRAINER_MATCHING_PRICE, currency: 'KRW', country: 'KR' },
{ variantKey: 'DEFAULT' }
);
// 여기까지 안 오는 문제가 발생합니다.
// async await 는 시점 디버깅을 위해 추가했습니다. then 사용해도 동일하게 android 에서만 위 renderPaymentMethods 메소드가 동작하지 않습니다. 리소스 경쟁이 발생하는 건지, 교착상태에 빠진 걸로 보입니다.
console.debug('
setPaymentMethodWidgetControl(control);
} catch (error: any) {
console.error('
Alert.alert('결제 위젯 초기화 오류', error.message || JSON.stringify(error));
}
}}
/>
)}
코드 일 부분인데 주석으로 상세하게 이슈를 남겼습니다. 감사합니다.
GitHub
토스페이먼츠 SDK v1 샘플 프로젝트입니다. . Contribute to tosspayments/tosspayments-sample-v1 development by creating an account on GitHub.
