@koin_payments/react-native-payments-plugin
Version:
Plugin React Native oficial da Koin para integraΓ§Γ£o com o SDK de Payments, permitindo adicionar funcionalidades de pagamento de forma simples e segura
35 lines (31 loc) β’ 1.42 kB
JavaScript
;
import { TurboModuleRegistry } from 'react-native';
// Debug function to check TurboModule availability
const checkTurboModule = () => {
console.log('π Checking TurboModuleRegistry for PaymentsReactNativePlugin...');
try {
const turboModule = TurboModuleRegistry.getEnforcing('PaymentsReactNativePlugin');
console.log('β
TurboModule found and registered successfully');
return turboModule;
} catch (error) {
console.error('β TurboModule not found:', error);
return null;
}
};
// Create safe wrapper with fallback for TurboModule
const createSafeTurboModule = () => {
const turboModule = checkTurboModule();
if (!turboModule) {
console.error('π¨ TurboModule not found! Creating fallback...');
// Return fallback implementation that throws meaningful errors
return {
initializeSDK: () => Promise.reject(new Error('TurboModule PaymentsReactNativePlugin not found. Make sure New Architecture is enabled and the module is properly configured.')),
initiatePayment: () => Promise.reject(new Error('TurboModule PaymentsReactNativePlugin not found. Make sure New Architecture is enabled and the module is properly configured.'))
};
}
console.log('β
TurboModule found and ready');
return turboModule;
};
// Use safe TurboModule wrapper
export default createSafeTurboModule();
//# sourceMappingURL=NativePaymentsReactNativePlugin.js.map