From 07082453c55e8091020e582476ec65367575057f Mon Sep 17 00:00:00 2001 From: Ahmed Eid Date: Mon, 19 Feb 2024 12:38:23 +0200 Subject: [PATCH] android custom theme color. --- .../src/main/java/com/reactnativepaymob/PaymobModule.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/reactnativepaymob/PaymobModule.java b/android/src/main/java/com/reactnativepaymob/PaymobModule.java index c5c5381..d83f925 100644 --- a/android/src/main/java/com/reactnativepaymob/PaymobModule.java +++ b/android/src/main/java/com/reactnativepaymob/PaymobModule.java @@ -1,6 +1,7 @@ package com.reactnativepaymob; import android.content.Intent; import android.os.Bundle; +import android.graphics.Color; import android.app.Activity; import com.facebook.react.bridge.ReactApplicationContext; @@ -175,12 +176,17 @@ public void presentPayVC(ReadableMap params, Promise promise) { pay_intent.putExtra("PAY_BUTTON_TEXT", params.getString("buttonText")); } - try { + try { int colorValue = ContextCompat.getColor(currentActivity, com.google.android.material.R.color.cardview_dark_background); pay_intent.putExtra(PayActivityIntentKeys.THEME_COLOR, colorValue); } catch (Resources.NotFoundException e) { } + if(params.getString("buttonBg") != null) { + int colorValue = Color.parseColor(params.getString("buttonBg")); + pay_intent.putExtra(PayActivityIntentKeys.THEME_COLOR, colorValue); + } + pay_intent.putExtra("language", params.getBoolean("isEnglish") ? "en" : "ar"); pay_intent.putExtra("ActionBar", false);