@@ -179,6 +179,155 @@ enum InstallmentType {
179
179
}
180
180
```
181
181
182
+ ## 🎨 UI Customization & Theming
183
+
184
+ Customize the appearance of PagBank SDK modal dialogs to match your app's design. The library provides complete control over colors, themes, and UI elements displayed during payment transactions.
185
+
186
+ <div align =" center " >
187
+ <img src =" https://github.com/mCodex/react-native-plugpag-nitro/assets/modal-example.png " alt =" Customizable Payment Modal " width =" 400 " />
188
+ <p ><em >Payment modal with custom dark theme matching your app's design</em ></p >
189
+ </div >
190
+
191
+ ### ⚡ Quick Theme Setup
192
+
193
+ ``` typescript
194
+ import { setStyleTheme , PlugPagThemes } from ' react-native-plugpag-nitro' ;
195
+
196
+ // Apply predefined dark theme (matches the modal above)
197
+ await setStyleTheme (PlugPagThemes .DARK_THEME );
198
+
199
+ // Or create a custom theme
200
+ await setStyleTheme ({
201
+ headBackgroundColor: ' #1A1A1D' , // Header background
202
+ headTextColor: ' #FFFFFF' , // Header text
203
+ positiveButtonBackground: ' #22C55E' , // "Confirm" button color
204
+ negativeButtonBackground: ' #EF4444' , // "Cancel" button color
205
+ contentTextColor: ' #FFFFFF' , // Body text color
206
+ lineColor: ' #71717A' // Borders and lines
207
+ });
208
+ ```
209
+
210
+ ### 🎯 Available Themes
211
+
212
+ | Theme | Description | Use Case |
213
+ | -------| -------------| ----------|
214
+ | ` DARK_THEME ` | Dark theme matching modern apps | Apps with dark UI |
215
+ | ` LIGHT_THEME ` | Clean light theme | Apps with light UI |
216
+ | ` PAGBANK_THEME ` | Official PagBank colors | Brand consistency |
217
+ | ` HIGH_CONTRAST_THEME ` | Accessibility-focused | Better accessibility |
218
+
219
+ ### 🛠️ Custom Theme Creation
220
+
221
+ ``` typescript
222
+ // Brand-based theme
223
+ const customTheme = PlugPagThemes .createCustomTheme (
224
+ ' #00D4FF' , // Your primary brand color
225
+ ' #1A1A1D' , // Background color
226
+ ' #FFFFFF' , // Text color
227
+ true // Use dark theme as base
228
+ );
229
+
230
+ // Monochromatic theme
231
+ const monoTheme = PlugPagThemes .createMonochromaticTheme (
232
+ ' #7C3AED' , // Base purple color
233
+ true // Dark variant
234
+ );
235
+
236
+ await setStyleTheme (customTheme );
237
+ ```
238
+
239
+ ### 🎨 Complete Style Properties
240
+
241
+ <details >
242
+ <summary ><strong >📋 All available style properties</strong ></summary >
243
+
244
+ ``` typescript
245
+ interface PlugpagStyleData {
246
+ // Header styling
247
+ headTextColor? : string ; // Header text color
248
+ headBackgroundColor? : string ; // Header background color
249
+
250
+ // Content styling
251
+ contentTextColor? : string ; // General content text
252
+ contentTextValue1Color? : string ; // Primary monetary values
253
+ contentTextValue2Color? : string ; // Secondary monetary values
254
+
255
+ // Button styling
256
+ positiveButtonTextColor? : string ; // Confirm button text
257
+ positiveButtonBackground? : string ; // Confirm button background
258
+ negativeButtonTextColor? : string ; // Cancel button text
259
+ negativeButtonBackground? : string ; // Cancel button background
260
+ genericButtonBackground? : string ; // Generic button background
261
+ genericButtonTextColor? : string ; // Generic button text
262
+
263
+ // Input field styling
264
+ genericSmsEditTextBackground? : string ; // SMS input background
265
+ genericSmsEditTextTextColor? : string ; // SMS input text
266
+
267
+ // Interface elements
268
+ lineColor? : string ; // Lines, borders, dividers
269
+ }
270
+ ```
271
+
272
+ </details >
273
+
274
+ ### 🔧 Theme Utilities
275
+
276
+ ``` typescript
277
+ import { ThemeUtils } from ' react-native-plugpag-nitro' ;
278
+
279
+ // Validate theme colors
280
+ const errors = ThemeUtils .validateTheme (myTheme );
281
+ if (errors .length === 0 ) {
282
+ await setStyleTheme (myTheme );
283
+ }
284
+
285
+ // Merge themes
286
+ const customizedTheme = ThemeUtils .mergeThemes (
287
+ PlugPagThemes .DARK_THEME ,
288
+ { positiveButtonBackground: ' #FF6B6B' }
289
+ );
290
+
291
+ // Preview theme colors (for debugging)
292
+ const preview = ThemeUtils .createThemePreview (myTheme );
293
+ console .log (preview ); // { headBackgroundColor: '#1A1A1D', ... }
294
+ ```
295
+
296
+ ### 💡 Best Practices
297
+
298
+ - ** Apply early** : Set themes during app initialization, before payment operations
299
+ - ** Match your design** : Use colors that complement your existing UI
300
+ - ** Accessibility** : Ensure sufficient contrast between text and backgrounds
301
+ - ** Validation** : Always validate themes before applying them
302
+ - ** Error handling** : Wrap theme operations in try-catch blocks
303
+
304
+ ### 🏗️ Integration Example
305
+
306
+ ``` typescript
307
+ import React , { useEffect } from ' react' ;
308
+ import { setStyleTheme , PlugPagThemes } from ' react-native-plugpag-nitro' ;
309
+
310
+ export default function App() {
311
+ useEffect (() => {
312
+ // Apply theme matching your app's design
313
+ const initializeTheme = async () => {
314
+ try {
315
+ await setStyleTheme (PlugPagThemes .DARK_THEME );
316
+ console .log (' Theme applied successfully' );
317
+ } catch (error ) {
318
+ console .error (' Failed to apply theme:' , error );
319
+ }
320
+ };
321
+
322
+ initializeTheme ();
323
+ }, []);
324
+
325
+ // ... rest of your app
326
+ }
327
+ ```
328
+
329
+ > 📖 ** Complete styling guide** : See [ STYLING_GUIDE.md] ( STYLING_GUIDE.md ) for detailed documentation and examples.
330
+
182
331
## 💡 Usage Examples
183
332
184
333
### Complete Payment Flow
0 commit comments