Skip to content

Commit

Permalink
android custom theme color.
Browse files Browse the repository at this point in the history
  • Loading branch information
a-eid committed Feb 19, 2024
1 parent ddbe5da commit 0708245
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 0708245

Please sign in to comment.