react-native-boxes 1.4.76 → 1.4.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +567 -542
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,542 +1,567 @@
1
- # React Native Boxes
2
- ![Android](https://img.shields.io/badge/Android-3DDC84?style=for-the-badge&logo=android&logoColor=white)
3
- ![Web](https://img.shields.io/badge/Web-4285F4?style=for-the-badge&logo=google-chrome&logoColor=white)
4
- ![iOS](https://img.shields.io/badge/iOS-000000?style=for-the-badge&logo=apple&logoColor=white)
5
-
6
-
7
- A simple to use react library that does all the UI heavy lifting for you so that you can focus on value and not code !
8
-
9
- Out-of-the box comes with:
10
- - Themes
11
- - Layouts (Cards, Vertical, Horizontal, Centered etc.)
12
- - Texts (Title, Subtitle, Text, Caption etc.)
13
- - Buttons (Simple, Transparent, Loading etc.)
14
- - Images and Icons (Icons, Avatars, Images etc.)
15
- - Font (Specify Regular, Styled and Bold fonts)
16
- - Bars (Toolbars, Bottom nav bars etc.)
17
- - Modals (Dialogboxes, Selection bottomsheet, Horizontal selection etc.)
18
- - Expand box (Animated)
19
- - Lists (Simple data list)
20
- - Webview (In app web browser)
21
- - Internationalization (I18n)
22
- - Analytics (Clicks, Impression tracking)
23
-
24
- ## Install
25
-
26
- ```
27
- npm install react-native-boxes
28
- ```
29
-
30
- ## Dependencies
31
-
32
- Make sure you have following dependencies installed. The versions can be any satisfying version but must not have any breaking changes.
33
-
34
- ```
35
- "@expo/vector-icons": "^13.0.0",
36
- "react": "^18.2.0",
37
- "@react-native-async-storage/async-storage": "1.23.1",
38
- "react-native": "^0.73.6",
39
- "react-native-safe-area-context": "^4.9.0",
40
- "react-native-gesture-handler":"~2.14.0"
41
- ```
42
-
43
- ## Usage
44
- At the root of your app you must add a theme context and thats it! You are good to go.
45
- ```
46
- import { Colors, DarkColors, Theme } from 'react-native-boxes';
47
- import { GestureHandlerRootView } from 'react-native-gesture-handler';
48
-
49
- export default function App(){
50
- const colorScheme = 'dark'
51
- const theme = new Theme('my-app', colorScheme === 'dark' ? DarkColors : Colors);
52
- return (
53
- <ThemeContext.Provider value={theme} >
54
- <GestureHandlerRootView>
55
- <WatchlistPage />
56
- </GestureHandlerRootView>
57
- </ThemeContext.Provider>
58
- )
59
- }
60
- ```
61
- Optional: If you are also gonna use bottomsheets, Add `GestureHandlerRootView`
62
-
63
- ## Components
64
-
65
- ### Themes
66
- Dark colors and Light colors come out of the box.
67
-
68
- Dark Colors
69
-
70
- ![image](https://github.com/user-attachments/assets/e95508cb-497a-4341-a32f-cacdf2daea07)
71
-
72
-
73
- Light Colors
74
-
75
- ![image](https://github.com/user-attachments/assets/ed97e567-2160-487a-85f9-c1a21abbca86)
76
-
77
-
78
- <details>
79
- <summary>Customizing theme</summary>
80
-
81
- import { Colors, Theme } from 'react-native-boxes';
82
- ...
83
-
84
- const MyColors = Object.assign(Colors, {
85
- accent: '#086CFE',
86
- accentLight: '#337DFF',
87
- text: '#444444',
88
- caption: '#A9A9A9',
89
- heading: '#222222',
90
- background: '#E6E6E6',
91
- forground: '#fff',
92
- transparent: 'transparent',
93
- semitransparent: '#111a1a1c',
94
- info: '#2196F3',
95
- success: '#4CAF50',
96
- successBackground: '#388E3C',
97
- warning: '#FFA726',
98
- critical: '#F44336',
99
- invert: {
100
- text: '#fff',
101
- caption: '#fff',
102
- heading: '#fff',
103
- background: '#1a1a1c'
104
- }
105
- })
106
- const theme = new Theme('my-app', MyColors);
107
- return (
108
- <ThemeContext.Provider value={theme} >
109
- <WatchlistPage />
110
- </ThemeContext.Provider>
111
- )
112
-
113
- </details>
114
-
115
- You can also customize sizes, dimensions etc, but it is not recommended.
116
- <details>
117
- <summary>Customizing other theme options</summary>
118
-
119
- const theme = new Theme(
120
- appname = '',
121
- colors ,
122
- dimens ,
123
- fonts ,
124
- styles ,
125
- )
126
-
127
- </details>
128
-
129
-
130
- ### Layouts
131
-
132
- ### VPage
133
- Your root tag for pages. Consists of vertical alignment and some basic padding.
134
-
135
- ![image](https://github.com/user-attachments/assets/85488495-4225-4a88-86b3-ecead70f647d)
136
-
137
- <details>
138
- <summary>Code sample</summary>
139
-
140
- <VPage>
141
- <Title>Watchlist1</Title>
142
- </VPage>
143
-
144
- </details>
145
-
146
- #### Center
147
- ![image](https://github.com/user-attachments/assets/71ea1680-5b43-42b6-81c6-f03799912e95)
148
-
149
- <details>
150
- <summary>Code sample</summary>
151
-
152
- <Center>
153
- <Title>Watchlist</Title>
154
- <Caption>Coming soon </Caption>
155
- </Center>
156
-
157
- </details>
158
-
159
- #### VBox
160
- ![image](https://github.com/user-attachments/assets/b4d765c6-5879-4880-a28c-3aca0e88a07b)
161
-
162
- <details>
163
- <summary>Code sample</summary>
164
-
165
- <VBox>
166
- <Title>Watchlist</Title>
167
- <Caption>Coming soon </Caption>
168
- </VBox>
169
-
170
- </details>
171
-
172
-
173
- #### HBox
174
- ![image](https://github.com/user-attachments/assets/0b868e4e-d637-4ac9-a695-20bd420f1fad)
175
-
176
- <details>
177
- <summary>Code sample</summary>
178
-
179
- <HBox>
180
- <Title>Watchlist1</Title>
181
- <Title>Watchlist2</Title>
182
- </HBox>
183
-
184
- </details>
185
-
186
-
187
- ### Texts
188
- ![image](https://github.com/user-attachments/assets/5346a25f-a22e-495e-994e-a2bd2931de5d)
189
-
190
- <details>
191
- <summary>Code sample</summary>
192
- Icons are from Fontawesome
193
- https://icons.expo.fyi/Index
194
-
195
- <Title>Watchlist Title</Title>
196
- <TextView>
197
- This is a text with a simple example from a watchlist screen. You can add stocks to your watchlist and see their performance. You can also add alerts to get notified when a stock reaches a certain price.
198
- </TextView>
199
- <Subtitle>This is a subtitle for watchlist</Subtitle>
200
- <TitleText>
201
- This is a title text that explains what a watchlist is.
202
- </TitleText>
203
- <TextView>
204
- A watchlist is a list of stocks that you are interested in.
205
- </TextView>
206
- <TitleText>
207
- This is a another title text that explains what a watchlist is.
208
- </TitleText>
209
- <TextView>
210
- A watchlist is a list of stocks that you are interested in.
211
- </TextView>
212
- <Caption>
213
- This is a caption. All investments are subject to market risk. Please do your own research before investing in any stock. This app is for educational purposes only.
214
- </Caption>
215
-
216
- </details>
217
-
218
-
219
- ### Images
220
-
221
- #### Avatars
222
-
223
- ![image](https://github.com/user-attachments/assets/0e6b7ce7-9302-40b8-a570-4e166f6a423d)
224
-
225
-
226
- - With icon
227
- - With image url
228
- - With text
229
-
230
- <details>
231
- <summary>Code sample</summary>
232
-
233
-
234
- <Avatar iconName='user' />
235
- <Avatar iconUrl='https://avatars.githubusercontent.com/u/16799797?v=4' />
236
- <Avatar iconText='SN' />
237
-
238
- </details>
239
-
240
- #### Icons
241
- Support for Fontawesome icon names from https://icons.expo.fyi/
242
-
243
- ![image](https://github.com/user-attachments/assets/b36ac996-556d-4027-ac6a-454bd65d7a50)
244
-
245
- <details>
246
- <summary>Code sample</summary>
247
-
248
- <Icon name='home' size={50} />
249
- <Title>Light Theme Watchlist</Title>
250
-
251
- </details>
252
-
253
- ### Buttons
254
-
255
- <details>
256
- <summary>Simple button code sample</summary>
257
-
258
- <ButtonView text='Simple Button' />
259
-
260
- </details>
261
-
262
- ![image](https://github.com/user-attachments/assets/55c063be-5a24-434b-b027-2ca0b88878f6)
263
-
264
-
265
- <details>
266
- <summary>Transparent button code sample</summary>
267
-
268
- <TransparentButton text='Transparent Button' />
269
-
270
- </details>
271
-
272
- ![image](https://github.com/user-attachments/assets/e45fa3ff-ab51-4241-9c2a-62d01cfd365e)
273
-
274
-
275
- <details>
276
- <summary>Loading button code sample</summary>
277
-
278
- const [loading, setLoading] = useState(false)
279
-
280
- <LoadingButton loading={loading} text='Loading Button' onPress={() => {
281
- setLoading((prev) => !prev)
282
- }} />
283
-
284
- </details>
285
-
286
- ![ezgif-451f0321da765b](https://github.com/user-attachments/assets/7bd832ac-c5d1-4dbf-8faf-5aa9f3a72cc7)
287
-
288
- ### Bottombar
289
- ![image](https://github.com/user-attachments/assets/402682fc-35aa-42bc-905d-da6509aec269)
290
-
291
- <details>
292
- <summary>Code sample</summary>
293
- Icons are from Fontawesome
294
- https://icons.expo.fyi/Index
295
-
296
- export default function AppBottomBar() {
297
- const theme = useContext(ThemeContext)
298
- const router = useRouter()
299
- const [selectedId, setSelectedId] = React.useState('watchlist')
300
- return (
301
- <BottomNavBar
302
- selectedId={selectedId}
303
- options={[
304
- {
305
- id: 'watchlist',
306
- icon: 'bookmark',
307
- title: 'Watchlist'
308
- },
309
- {
310
- id: 'orders',
311
- icon: 'file-text',
312
- title: 'Orders'
313
- },
314
- {
315
- id: 'positions',
316
- icon: 'briefcase',
317
- title: 'Positions'
318
- },
319
- {
320
- id: 'settings',
321
- icon: 'gears',
322
- title: 'Settings'
323
- }
324
- ]}
325
- onSelect={(selectedId) => {
326
- console.log('selected', selectedId)
327
- setSelectedId(selectedId)
328
- router.push('/explore')
329
- }} />
330
- )
331
- }
332
-
333
- </details>
334
-
335
-
336
- ### Expand
337
- ![Recording 2025-03-01 201906](https://github.com/user-attachments/assets/b69d5ea1-d6d3-4285-b1b1-b8aaeb5536bb)
338
-
339
- <details>
340
- <summary>Code sample</summary>
341
-
342
- <Expand title='Expand Watchlist' >
343
- <TextView>INFY</TextView>
344
- <TextView>TCS</TextView>
345
- </Expand>
346
-
347
- </details>
348
-
349
-
350
- ### Toolbars
351
-
352
- ### Simple Toolbar
353
-
354
- ![image](https://github.com/user-attachments/assets/c49c8292-4e35-4c9a-813e-3478abc1da11)
355
-
356
- <details>
357
- <summary>Code sample</summary>
358
-
359
- <SimpleToolbar title="Watchlist" />
360
-
361
- </details>
362
-
363
- ### Transparent Center Toolbar
364
-
365
- ![image](https://github.com/user-attachments/assets/7b07ae8c-751c-43b2-90a6-3fb6ef97ab49)
366
-
367
- <details>
368
- <summary>Code sample</summary>
369
-
370
- <SimpleToolbar title="Watchlist" />
371
-
372
- </details>
373
-
374
- ### Toolbar with buttons
375
-
376
- ![image](https://github.com/user-attachments/assets/69924f9b-6fbf-47ca-b756-b34f705f1abf)
377
-
378
- <details>
379
- <summary>Code sample</summary>
380
-
381
- <TransparentCenterToolbar
382
- homeIcon={"arrow-left"}
383
- title="Watchlist"
384
- options={[{
385
- id: 'search',
386
- icon: 'search',
387
- onClick: () => {
388
- console.log('Search clicked')
389
- }
390
- }]}
391
- />
392
-
393
- </details>
394
-
395
-
396
-
397
- ### Divider
398
-
399
- ![image](https://github.com/user-attachments/assets/553f6f23-853d-4233-b771-2b731674c8fd)
400
-
401
- <details>
402
- <summary>Code sample</summary>
403
-
404
- <Expand title='Expand Watchlist' >
405
- <TextView>INFY</TextView>
406
- <TextView>TCS</TextView>
407
- </Expand>
408
-
409
- </details>
410
-
411
- ### Modals
412
-
413
- #### Bottomsheet on mobile
414
-
415
- ![mobile sheet](https://github.com/user-attachments/assets/96c64fb9-9b00-49e3-8c4e-785772e0e880)
416
-
417
- <details>
418
- <summary>Code sample</summary>
419
-
420
-
421
- <BottomSheet title="Bottomsheet About Watchlists" visible={showDialog} onDismiss={() => setShowDialog(false)}>
422
- <TextView>
423
- This is a simple dialog that can be used to show more information to the user. It is a bottom sheet that can host any content.
424
- </TextView>
425
- <HBox />
426
- <TextView>
427
- Watchlists are a great way to keep track of your favorite stocks. You can add stocks to your watchlist and see their performance. You can also add alerts to get notified when a stock reaches a certain price.
428
- </TextView>
429
- <TertiaryButtonView text='Goto Watchlist' onPress={() => setShowDialog(false)} />
430
- </BottomSheet>
431
-
432
- </details>
433
-
434
- #### Bottomsheet on Desktop (web)
435
-
436
- ![desktop sheet](https://github.com/user-attachments/assets/6fbaacb0-c134-43ca-af8c-6089c3b32cc7)
437
-
438
- ### Web view
439
- Opens a webview on native and a `iframe` on Web
440
-
441
- <details>
442
- <summary>Code sample</summary>
443
-
444
- <WebBrowserView url='https://www.google.com' title='Google'/>
445
-
446
- </details>
447
-
448
- ### Internationalization
449
-
450
- Install your favorite js library.
451
-
452
- ![locale](https://github.com/user-attachments/assets/48d3ea46-482f-49f3-8010-52433f15551c)
453
-
454
-
455
-
456
- <details>
457
- <summary>Code sample</summary>
458
-
459
- import { I18n } from 'i18n-js';
460
-
461
- const I18nProvider = new I18n({
462
- en: {
463
- watchlist: {
464
- hello: 'Hello!'
465
- }
466
- },
467
- hi: {
468
- watchlist: {
469
- hello: 'नमस्ते !'
470
- }
471
- },
472
- hinglish: {
473
- watchlist: {
474
- hello: 'Namaste !'
475
- }
476
- },
477
- es: {
478
- watchlist: {
479
- hello: 'Hola!'
480
- }
481
- }
482
- });
483
- I18nProvider.missingBehavior = "guess";
484
-
485
-
486
- export default function App(){
487
- const [locale, setLocale] = useState('en')
488
- I18nProvider.locale = locale
489
- const theme = new Theme('appname', colorScheme === 'dark' ? DarkColors : Colors);
490
- theme.i18n = I18nProvider
491
-
492
-
493
- return (
494
- <ThemeContext.Provider value={theme} >
495
- <Center>
496
- <Title>watchlist.hello</Title>
497
- </Center>
498
- <Center>
499
- <HBox>
500
- <TransparentButton text='English' onPress={() => {
501
- setLocale('en')
502
- }} />
503
- <TransparentButton text='Hindi' onPress={() => {
504
- setLocale('hi')
505
-
506
- }} />
507
- </HBox>
508
- <HBox>
509
- <TransparentButton text='Hinglish' onPress={() => {
510
- setLocale('hinglish')
511
-
512
- }} />
513
- <TransparentButton text='Spanish' onPress={() => {
514
- setLocale('es')
515
-
516
- }} />
517
- </HBox>
518
- </Center>
519
- </ThemeContext.Provider>
520
- )
521
- }
522
- </details>
523
-
524
-
525
-
526
- ### Analytics
527
- If you wanna track the users clicks and impressions on each component, just add a `onTrack` hook to your theme.
528
-
529
- ```
530
- action : TrackingActionType = click | view | navigate
531
- view : TrackingViewType = button | dropdown...
532
- text : The text related to the component if present
533
- extra : Depending on component, some contextual info. For e.g. the WebView impression gives {url, title} extra
534
- ```
535
-
536
- <details>
537
-
538
- const theme = new Theme('appname', DarkColors);
539
- theme.onTrack = (action, view, text, extras) => {
540
- myTracker.track(`${action}-${text}-${text}`, extras)
541
- }
542
- </details>
1
+ <h1 align="center">React Native Boxes</h1>
2
+
3
+ <p align="center">
4
+ A simple-to-use React Native UI SDK that does all the UI heavy lifting for you —
5
+ so you can focus on value, not boilerplate code! Built using barebone react-native and Expo components with almost no third-party dependencies.
6
+ </p>
7
+
8
+ <p align="center">
9
+ <img src="https://img.shields.io/badge/Android-3DDC84?style=for-the-badge&logo=android&logoColor=white" alt="Android">
10
+ <img src="https://img.shields.io/badge/Web-4285F4?style=for-the-badge&logo=google-chrome&logoColor=white" alt="Web">
11
+ <img src="https://img.shields.io/badge/iOS-000000?style=for-the-badge&logo=apple&logoColor=white" alt="iOS">
12
+ </p>
13
+
14
+ <p align="center">
15
+ <img src="https://github.com/user-attachments/assets/9174e501-eb08-46ec-8a38-90e8ec8931c5"
16
+ alt="collage" width="512px">
17
+ </p>
18
+
19
+ <br>
20
+
21
+
22
+
23
+
24
+ Out-of-the box comes with:
25
+ - Themes
26
+ - Layouts (Cards, Vertical, Horizontal, Centered etc.)
27
+ - Texts (Title, Subtitle, Text, Caption etc.)
28
+ - Buttons (Simple, Transparent, Loading etc.)
29
+ - Images and Icons (Icons, Avatars, Images etc.)
30
+ - Font (Specify Regular, Styled and Bold fonts)
31
+ - Bars (Toolbars, Bottom nav bars etc.)
32
+ - Modals (Dialogboxes, Selection bottomsheet, Horizontal selection etc.)
33
+ - Expand box (Animated)
34
+ - Lists (Simple data list)
35
+ - Webview (In app web browser)
36
+ - Internationalization (I18n)
37
+ - Analytics (Clicks, Impression tracking)
38
+
39
+ ## Install
40
+
41
+ ```
42
+ npm install react-native-boxes
43
+ ```
44
+
45
+ ## Dependencies
46
+
47
+ Make sure you have following dependencies installed. The versions can be any satisfying version but must not have any breaking changes.
48
+
49
+ ```
50
+ "@expo/vector-icons": "^13.0.0",
51
+ "react": "^18.2.0",
52
+ "@react-native-async-storage/async-storage": "1.23.1",
53
+ "react-native": "^0.73.6",
54
+ "react-native-safe-area-context": "^4.9.0",
55
+ "react-native-gesture-handler":"~2.14.0"
56
+ ```
57
+
58
+ ## Usage
59
+ At the root of your app you must add a theme context and thats it! You are good to go.
60
+ ```
61
+ import { Colors, DarkColors, Theme } from 'react-native-boxes';
62
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
63
+
64
+ export default function App(){
65
+ const colorScheme = 'dark'
66
+ const theme = new Theme('my-app', colorScheme === 'dark' ? DarkColors : Colors);
67
+ return (
68
+ <ThemeContext.Provider value={theme} >
69
+ <GestureHandlerRootView>
70
+ <WatchlistPage />
71
+ </GestureHandlerRootView>
72
+ </ThemeContext.Provider>
73
+ )
74
+ }
75
+ ```
76
+ Optional: If you are also gonna use bottomsheets, Add `GestureHandlerRootView`
77
+
78
+ ## Components
79
+
80
+ ### Themes
81
+ Dark colors and Light colors come out of the box.
82
+
83
+ Dark Colors
84
+
85
+ ![image](https://github.com/user-attachments/assets/e95508cb-497a-4341-a32f-cacdf2daea07)
86
+
87
+
88
+ Light Colors
89
+
90
+ ![image](https://github.com/user-attachments/assets/ed97e567-2160-487a-85f9-c1a21abbca86)
91
+
92
+
93
+ <details>
94
+ <summary>Customizing theme</summary>
95
+
96
+ import { Colors, Theme } from 'react-native-boxes';
97
+ ...
98
+
99
+ const MyColors = Object.assign(Colors, {
100
+ accent: '#086CFE',
101
+ accentLight: '#337DFF',
102
+ text: '#444444',
103
+ caption: '#A9A9A9',
104
+ heading: '#222222',
105
+ background: '#E6E6E6',
106
+ forground: '#fff',
107
+ transparent: 'transparent',
108
+ semitransparent: '#111a1a1c',
109
+ info: '#2196F3',
110
+ success: '#4CAF50',
111
+ successBackground: '#388E3C',
112
+ warning: '#FFA726',
113
+ critical: '#F44336',
114
+ invert: {
115
+ text: '#fff',
116
+ caption: '#fff',
117
+ heading: '#fff',
118
+ background: '#1a1a1c'
119
+ }
120
+ })
121
+ const theme = new Theme('my-app', MyColors);
122
+ return (
123
+ <ThemeContext.Provider value={theme} >
124
+ <WatchlistPage />
125
+ </ThemeContext.Provider>
126
+ )
127
+
128
+ </details>
129
+
130
+ You can also customize sizes, dimensions etc, but it is not recommended.
131
+ <details>
132
+ <summary>Customizing other theme options</summary>
133
+
134
+ const theme = new Theme(
135
+ appname = '',
136
+ colors ,
137
+ dimens ,
138
+ fonts ,
139
+ styles ,
140
+ )
141
+
142
+ </details>
143
+
144
+ ### Fonts
145
+
146
+ Load the below font names. Different components use different font families.
147
+ ```
148
+ loadAsync({
149
+ 'Regular': require('./assets/fonts/Regular.ttf'), // Used in all general texts
150
+ 'Bold': require('./assets/fonts/Bold.ttf'), // Used in Buttons and Headings
151
+ 'Styled': require('./assets/fonts/Styled.ttf'), // Used in special places
152
+ })
153
+ ```
154
+
155
+ ### Layouts
156
+
157
+ ### VPage
158
+ Your root tag for pages. Consists of vertical alignment and some basic padding.
159
+
160
+ ![image](https://github.com/user-attachments/assets/85488495-4225-4a88-86b3-ecead70f647d)
161
+
162
+ <details>
163
+ <summary>Code sample</summary>
164
+
165
+ <VPage>
166
+ <Title>Watchlist1</Title>
167
+ </VPage>
168
+
169
+ </details>
170
+
171
+ #### Center
172
+ ![image](https://github.com/user-attachments/assets/71ea1680-5b43-42b6-81c6-f03799912e95)
173
+
174
+ <details>
175
+ <summary>Code sample</summary>
176
+
177
+ <Center>
178
+ <Title>Watchlist</Title>
179
+ <Caption>Coming soon </Caption>
180
+ </Center>
181
+
182
+ </details>
183
+
184
+ #### VBox
185
+ ![image](https://github.com/user-attachments/assets/b4d765c6-5879-4880-a28c-3aca0e88a07b)
186
+
187
+ <details>
188
+ <summary>Code sample</summary>
189
+
190
+ <VBox>
191
+ <Title>Watchlist</Title>
192
+ <Caption>Coming soon </Caption>
193
+ </VBox>
194
+
195
+ </details>
196
+
197
+
198
+ #### HBox
199
+ ![image](https://github.com/user-attachments/assets/0b868e4e-d637-4ac9-a695-20bd420f1fad)
200
+
201
+ <details>
202
+ <summary>Code sample</summary>
203
+
204
+ <HBox>
205
+ <Title>Watchlist1</Title>
206
+ <Title>Watchlist2</Title>
207
+ </HBox>
208
+
209
+ </details>
210
+
211
+
212
+ ### Texts
213
+ ![image](https://github.com/user-attachments/assets/5346a25f-a22e-495e-994e-a2bd2931de5d)
214
+
215
+ <details>
216
+ <summary>Code sample</summary>
217
+ Icons are from Fontawesome
218
+ https://icons.expo.fyi/Index
219
+
220
+ <Title>Watchlist Title</Title>
221
+ <TextView>
222
+ This is a text with a simple example from a watchlist screen. You can add stocks to your watchlist and see their performance. You can also add alerts to get notified when a stock reaches a certain price.
223
+ </TextView>
224
+ <Subtitle>This is a subtitle for watchlist</Subtitle>
225
+ <TitleText>
226
+ This is a title text that explains what a watchlist is.
227
+ </TitleText>
228
+ <TextView>
229
+ A watchlist is a list of stocks that you are interested in.
230
+ </TextView>
231
+ <TitleText>
232
+ This is a another title text that explains what a watchlist is.
233
+ </TitleText>
234
+ <TextView>
235
+ A watchlist is a list of stocks that you are interested in.
236
+ </TextView>
237
+ <Caption>
238
+ This is a caption. All investments are subject to market risk. Please do your own research before investing in any stock. This app is for educational purposes only.
239
+ </Caption>
240
+
241
+ </details>
242
+
243
+
244
+ ### Images
245
+
246
+ #### Avatars
247
+
248
+ ![image](https://github.com/user-attachments/assets/0e6b7ce7-9302-40b8-a570-4e166f6a423d)
249
+
250
+
251
+ - With icon
252
+ - With image url
253
+ - With text
254
+
255
+ <details>
256
+ <summary>Code sample</summary>
257
+
258
+
259
+ <Avatar iconName='user' />
260
+ <Avatar iconUrl='https://avatars.githubusercontent.com/u/16799797?v=4' />
261
+ <Avatar iconText='SN' />
262
+
263
+ </details>
264
+
265
+ #### Icons
266
+ Support for Fontawesome icon names from https://icons.expo.fyi/
267
+
268
+ ![image](https://github.com/user-attachments/assets/b36ac996-556d-4027-ac6a-454bd65d7a50)
269
+
270
+ <details>
271
+ <summary>Code sample</summary>
272
+
273
+ <Icon name='home' size={50} />
274
+ <Title>Light Theme Watchlist</Title>
275
+
276
+ </details>
277
+
278
+ ### Buttons
279
+
280
+ <details>
281
+ <summary>Simple button code sample</summary>
282
+
283
+ <ButtonView text='Simple Button' />
284
+
285
+ </details>
286
+
287
+ ![image](https://github.com/user-attachments/assets/55c063be-5a24-434b-b027-2ca0b88878f6)
288
+
289
+
290
+ <details>
291
+ <summary>Transparent button code sample</summary>
292
+
293
+ <TransparentButton text='Transparent Button' />
294
+
295
+ </details>
296
+
297
+ ![image](https://github.com/user-attachments/assets/e45fa3ff-ab51-4241-9c2a-62d01cfd365e)
298
+
299
+
300
+ <details>
301
+ <summary>Loading button code sample</summary>
302
+
303
+ const [loading, setLoading] = useState(false)
304
+
305
+ <LoadingButton loading={loading} text='Loading Button' onPress={() => {
306
+ setLoading((prev) => !prev)
307
+ }} />
308
+
309
+ </details>
310
+
311
+ ![ezgif-451f0321da765b](https://github.com/user-attachments/assets/7bd832ac-c5d1-4dbf-8faf-5aa9f3a72cc7)
312
+
313
+ ### Bottombar
314
+ ![image](https://github.com/user-attachments/assets/402682fc-35aa-42bc-905d-da6509aec269)
315
+
316
+ <details>
317
+ <summary>Code sample</summary>
318
+ Icons are from Fontawesome
319
+ https://icons.expo.fyi/Index
320
+
321
+ export default function AppBottomBar() {
322
+ const theme = useContext(ThemeContext)
323
+ const router = useRouter()
324
+ const [selectedId, setSelectedId] = React.useState('watchlist')
325
+ return (
326
+ <BottomNavBar
327
+ selectedId={selectedId}
328
+ options={[
329
+ {
330
+ id: 'watchlist',
331
+ icon: 'bookmark',
332
+ title: 'Watchlist'
333
+ },
334
+ {
335
+ id: 'orders',
336
+ icon: 'file-text',
337
+ title: 'Orders'
338
+ },
339
+ {
340
+ id: 'positions',
341
+ icon: 'briefcase',
342
+ title: 'Positions'
343
+ },
344
+ {
345
+ id: 'settings',
346
+ icon: 'gears',
347
+ title: 'Settings'
348
+ }
349
+ ]}
350
+ onSelect={(selectedId) => {
351
+ console.log('selected', selectedId)
352
+ setSelectedId(selectedId)
353
+ router.push('/explore')
354
+ }} />
355
+ )
356
+ }
357
+
358
+ </details>
359
+
360
+
361
+ ### Expand
362
+ ![Recording 2025-03-01 201906](https://github.com/user-attachments/assets/b69d5ea1-d6d3-4285-b1b1-b8aaeb5536bb)
363
+
364
+ <details>
365
+ <summary>Code sample</summary>
366
+
367
+ <Expand title='Expand Watchlist' >
368
+ <TextView>INFY</TextView>
369
+ <TextView>TCS</TextView>
370
+ </Expand>
371
+
372
+ </details>
373
+
374
+
375
+ ### Toolbars
376
+
377
+ ### Simple Toolbar
378
+
379
+ ![image](https://github.com/user-attachments/assets/c49c8292-4e35-4c9a-813e-3478abc1da11)
380
+
381
+ <details>
382
+ <summary>Code sample</summary>
383
+
384
+ <SimpleToolbar title="Watchlist" />
385
+
386
+ </details>
387
+
388
+ ### Transparent Center Toolbar
389
+
390
+ ![image](https://github.com/user-attachments/assets/7b07ae8c-751c-43b2-90a6-3fb6ef97ab49)
391
+
392
+ <details>
393
+ <summary>Code sample</summary>
394
+
395
+ <SimpleToolbar title="Watchlist" />
396
+
397
+ </details>
398
+
399
+ ### Toolbar with buttons
400
+
401
+ ![image](https://github.com/user-attachments/assets/69924f9b-6fbf-47ca-b756-b34f705f1abf)
402
+
403
+ <details>
404
+ <summary>Code sample</summary>
405
+
406
+ <TransparentCenterToolbar
407
+ homeIcon={"arrow-left"}
408
+ title="Watchlist"
409
+ options={[{
410
+ id: 'search',
411
+ icon: 'search',
412
+ onClick: () => {
413
+ console.log('Search clicked')
414
+ }
415
+ }]}
416
+ />
417
+
418
+ </details>
419
+
420
+
421
+
422
+ ### Divider
423
+
424
+ ![image](https://github.com/user-attachments/assets/553f6f23-853d-4233-b771-2b731674c8fd)
425
+
426
+ <details>
427
+ <summary>Code sample</summary>
428
+
429
+ <Expand title='Expand Watchlist' >
430
+ <TextView>INFY</TextView>
431
+ <TextView>TCS</TextView>
432
+ </Expand>
433
+
434
+ </details>
435
+
436
+ ### Modals
437
+
438
+ #### Bottomsheet on mobile
439
+
440
+ ![mobile sheet](https://github.com/user-attachments/assets/96c64fb9-9b00-49e3-8c4e-785772e0e880)
441
+
442
+ <details>
443
+ <summary>Code sample</summary>
444
+
445
+
446
+ <BottomSheet title="Bottomsheet About Watchlists" visible={showDialog} onDismiss={() => setShowDialog(false)}>
447
+ <TextView>
448
+ This is a simple dialog that can be used to show more information to the user. It is a bottom sheet that can host any content.
449
+ </TextView>
450
+ <HBox />
451
+ <TextView>
452
+ Watchlists are a great way to keep track of your favorite stocks. You can add stocks to your watchlist and see their performance. You can also add alerts to get notified when a stock reaches a certain price.
453
+ </TextView>
454
+ <TertiaryButtonView text='Goto Watchlist' onPress={() => setShowDialog(false)} />
455
+ </BottomSheet>
456
+
457
+ </details>
458
+
459
+ #### Bottomsheet on Desktop (web)
460
+
461
+ ![desktop sheet](https://github.com/user-attachments/assets/6fbaacb0-c134-43ca-af8c-6089c3b32cc7)
462
+
463
+ ### Web view
464
+ Opens a webview on native and a `iframe` on Web
465
+
466
+ <details>
467
+ <summary>Code sample</summary>
468
+
469
+ <WebBrowserView url='https://www.google.com' title='Google'/>
470
+
471
+ </details>
472
+
473
+ ### Internationalization
474
+
475
+ Install your favorite js library.
476
+
477
+ ![locale](https://github.com/user-attachments/assets/48d3ea46-482f-49f3-8010-52433f15551c)
478
+
479
+
480
+
481
+ <details>
482
+ <summary>Code sample</summary>
483
+
484
+ import { I18n } from 'i18n-js';
485
+
486
+ const I18nProvider = new I18n({
487
+ en: {
488
+ watchlist: {
489
+ hello: 'Hello!'
490
+ }
491
+ },
492
+ hi: {
493
+ watchlist: {
494
+ hello: 'नमस्ते !'
495
+ }
496
+ },
497
+ hinglish: {
498
+ watchlist: {
499
+ hello: 'Namaste !'
500
+ }
501
+ },
502
+ es: {
503
+ watchlist: {
504
+ hello: 'Hola!'
505
+ }
506
+ }
507
+ });
508
+ I18nProvider.missingBehavior = "guess";
509
+
510
+
511
+ export default function App(){
512
+ const [locale, setLocale] = useState('en')
513
+ I18nProvider.locale = locale
514
+ const theme = new Theme('appname', colorScheme === 'dark' ? DarkColors : Colors);
515
+ theme.i18n = I18nProvider
516
+
517
+
518
+ return (
519
+ <ThemeContext.Provider value={theme} >
520
+ <Center>
521
+ <Title>watchlist.hello</Title>
522
+ </Center>
523
+ <Center>
524
+ <HBox>
525
+ <TransparentButton text='English' onPress={() => {
526
+ setLocale('en')
527
+ }} />
528
+ <TransparentButton text='Hindi' onPress={() => {
529
+ setLocale('hi')
530
+
531
+ }} />
532
+ </HBox>
533
+ <HBox>
534
+ <TransparentButton text='Hinglish' onPress={() => {
535
+ setLocale('hinglish')
536
+
537
+ }} />
538
+ <TransparentButton text='Spanish' onPress={() => {
539
+ setLocale('es')
540
+
541
+ }} />
542
+ </HBox>
543
+ </Center>
544
+ </ThemeContext.Provider>
545
+ )
546
+ }
547
+ </details>
548
+
549
+
550
+
551
+ ### Analytics
552
+ If you wanna track the users clicks and impressions on each component, just add a `onTrack` hook to your theme.
553
+
554
+ ```
555
+ action : TrackingActionType = click | view | navigate
556
+ view : TrackingViewType = button | dropdown...
557
+ text : The text related to the component if present
558
+ extra : Depending on component, some contextual info. For e.g. the WebView impression gives {url, title} extra
559
+ ```
560
+
561
+ <details>
562
+
563
+ const theme = new Theme('appname', DarkColors);
564
+ theme.onTrack = (action, view, text, extras) => {
565
+ myTracker.track(`${action}-${text}-${text}`, extras)
566
+ }
567
+ </details>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-boxes",
3
- "version": "1.4.76",
3
+ "version": "1.4.78",
4
4
  "description": "A react native library for rapid development of UI using boxes",
5
5
  "main": "src/index.js",
6
6
  "scripts": {