// Copyright © 2022 Olo Inc. All rights reserved. // This software is made available under the Olo Pay SDK License (See LICENSE.md file) package com.olopaysdkreactnative.digitalwalletbutton import com.facebook.react.bridge.ReadableMap import com.facebook.react.uimanager.SimpleViewManager import com.facebook.react.uimanager.ThemedReactContext import com.facebook.react.uimanager.annotations.ReactProp import com.olopaysdkreactnative.digitalwalletbutton.events.DigitalWalletButtonClickedEvent class DigitalWalletButtonManager : SimpleViewManager() { override fun getName(): String { return "DigitalWalletButton" } override fun createViewInstance(reactContext: ThemedReactContext): DigitalWalletButton { return DigitalWalletButton(reactContext) } override fun getExportedCustomDirectEventTypeConstants(): MutableMap? { return mutableMapOf( DigitalWalletButtonClickedEvent.NAME to mapOf( "registrationName" to DigitalWalletButtonClickedEvent.NAME ) ) } @ReactProp(name = "isEnabled") fun setEnabled(view: DigitalWalletButton, enabled: Boolean?) { view.isEnabled = enabled ?: true } @ReactProp(name="googlePayConfig") fun setButtonStyles(view: DigitalWalletButton, buttonConfig: ReadableMap?) { view.updateConfig(buttonConfig) } }