react-native-boxes 1.2.11 → 1.2.13

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.
package/src/demo.tsx CHANGED
@@ -1,14 +1,14 @@
1
1
  import { useContext, useEffect, useReducer, useState } from 'react';
2
2
  import * as React from 'react'
3
- import { LayoutAnimation, SafeAreaView } from 'react-native';
4
- import { BottomNavBar, ButtonView, Caption, Center, CompositeTextInputView, Expand, HBox, LoadingButton, PressableView, RightIconButton, SimpleToolbar, Subtitle, TextInputView, TextView, Theme, ThemeContext, Title, VBox } from '.';
3
+ import { Alert, LayoutAnimation, SafeAreaView, Switch } from 'react-native';
4
+ import { BottomNavBar, ButtonView, Caption, Center, CompositeTextInputView, SimpleDatatlistViewItem, Expand, HBox, LoadingButton, PressableView, RightIconButton, SimpleToolbar, Subtitle, TextInputView, TextView, Theme, ThemeContext, Title, VBox, SimpleDatalistView } from '.';
5
5
  import FontAwesome from '@expo/vector-icons/FontAwesome';
6
6
  import { SafeAreaProvider } from 'react-native-safe-area-context';
7
7
  import { AlertMessage } from './Message';
8
- import { BottomSheet } from './Modal';
8
+ import { BottomSheet, DropDownView } from './Modal';
9
9
  import { Avatar, Icon } from './Image';
10
10
  import { ReactWrapper } from './utils';
11
- import KeyboardAvoidingScrollView from './Box';
11
+ import KeyboardAvoidingScrollView, { Box } from './Box';
12
12
  import { DarkColors, LightColors } from './Styles';
13
13
 
14
14
  export interface DemoScreenProps {
@@ -42,6 +42,32 @@ export function DemoScreen({ navigation }: DemoScreenProps) {
42
42
  }, [selectedTheme])
43
43
  const [, forceUpdate] = useReducer(x => x + 1, 0);
44
44
 
45
+
46
+
47
+ const dataList = [
48
+ {
49
+ country: 'India',
50
+ captialSlogan: 'Ye delhi hai mere yaar!',
51
+ about: 'India is a promise land in the heart of asia. Soon there will be akhand bharat!',
52
+ },
53
+ {
54
+ country: 'Japan',
55
+ captialSlogan: 'Land of the Rising Sun',
56
+ about: 'Japan is an island nation in East Asia. It is known for its advanced technology, rich history, and unique culture.',
57
+ },
58
+ {
59
+ country: 'Italy',
60
+ captialSlogan: 'The Boot-Shaped Beauty',
61
+ about: 'Italy is a country located in Southern Europe. It is known for its historical landmarks, delicious food, and beautiful scenery.',
62
+ },
63
+ {
64
+ country: 'Brazil',
65
+ captialSlogan: 'Land of Samba and Carnival',
66
+ about: 'Brazil is the largest country in South America. It is known for its vibrant culture, stunning beaches, and diverse rainforest.',
67
+ },
68
+ ];
69
+ const [selCountry, setSelCountry] = useState(dataList[0].country)
70
+
45
71
  return (
46
72
  <SafeAreaProvider>
47
73
  <VBox
@@ -139,6 +165,76 @@ export function DemoScreen({ navigation }: DemoScreenProps) {
139
165
  }}
140
166
  iconText='SN' />
141
167
  </Center>
168
+
169
+ <Expand title='Datalist' initialExpand={false}>
170
+ <SimpleDatalistView
171
+ items={dataList}
172
+ itemAdapter={(item) => {
173
+ const [isEnabled, setisEnabled] = useState(true)
174
+ return {
175
+ onPress: () => {
176
+ console.log('presssss')
177
+ },
178
+ action: (
179
+ <PressableView
180
+ onPress={(e) => {
181
+ e.stopPropagation()
182
+ }}>
183
+ <Switch
184
+ trackColor={{ false: '#767577', true: '#81b0ff' }}
185
+ thumbColor={'#f4f3f4'}
186
+ ios_backgroundColor="#3e3e3e"
187
+ value={isEnabled}
188
+ onValueChange={(enab) => {
189
+ setisEnabled(enab)
190
+ }}
191
+ />
192
+ </PressableView>
193
+
194
+ ),
195
+ icon: (
196
+ <Avatar iconText={item.country.substr(0, 2).toUpperCase()} />
197
+ ),
198
+ flexRatio: [2, 7, 1],
199
+ title: item.country,
200
+ subtitle: item.captialSlogan,
201
+ body: item.about
202
+ }
203
+ }}
204
+ />
205
+ <Box style={{
206
+ height: 0.1,
207
+ width: '100%',
208
+ margin: theme.dimens.space.md,
209
+ backgroundColor: theme.colors.caption
210
+ }} />
211
+ <SimpleDatatlistViewItem
212
+ icon={(
213
+ <Avatar iconText='GH' />
214
+ )}
215
+ flexRatio={[2.5, 6.5, 1]}
216
+ title='Go home'
217
+ subtitle="Go big or Go home !"
218
+ body="In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content. Lorem ipsum may be used as a placeholder before the final copy is available."
219
+ action={(<Icon name="arrow-right" onPress={() => {
220
+ console.log('pressed')
221
+ }} />)}
222
+ />
223
+
224
+ <SimpleDatatlistViewItem
225
+ icon="home"
226
+ title='Go home'
227
+ subtitle="In publishing and graphic design"
228
+ action={(<Icon name="arrow-right" />)} />
229
+
230
+ <SimpleDatatlistViewItem
231
+ icon="home"
232
+ title='Go home'
233
+ subtitle="In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content. Lorem ipsum may be used as a placeholder before the final copy is available."
234
+ action={(<Icon name="arrow-right" />)}
235
+ />
236
+ </Expand>
237
+
142
238
  <Expand title='Message Alert' initialExpand={false}
143
239
  style={{
144
240
  backgroundColor: theme.colors.forground
@@ -156,6 +252,39 @@ export function DemoScreen({ navigation }: DemoScreenProps) {
156
252
  </VBox>
157
253
 
158
254
  </Expand>
255
+ <Expand title='Dropdowns'
256
+ initialExpand={false}
257
+ >
258
+ <DropDownView
259
+ title={"Select Country"}
260
+ forceDialogSelectOnWeb={true}
261
+ onSelect={(id) => {
262
+ setSelCountry(id)
263
+ }}
264
+ selectedId={selCountry}
265
+ options={dataList.map((d) => {
266
+ return {
267
+ id: d.country,
268
+ value: d.captialSlogan,
269
+ title: d.captialSlogan
270
+ }
271
+ })} />
272
+ <DropDownView
273
+ displayType='button'
274
+ title={"Select Country"}
275
+ forceDialogSelectOnWeb={true}
276
+ onSelect={(id) => {
277
+ setSelCountry(id)
278
+ }}
279
+ selectedId={selCountry}
280
+ options={dataList.map((d) => {
281
+ return {
282
+ id: d.country,
283
+ value: d.captialSlogan,
284
+ title: d.captialSlogan
285
+ }
286
+ })} />
287
+ </Expand>
159
288
  <Expand
160
289
  style={{
161
290
  padding: 0,
package/src/index.d.ts CHANGED
@@ -10,3 +10,4 @@ export * from './Styles';
10
10
  export * from './demo';
11
11
  export * from './ThemeContext';
12
12
  export * from './I18n';
13
+ export * from './List';
package/src/index.js CHANGED
@@ -26,4 +26,5 @@ __exportStar(require("./Styles"), exports);
26
26
  __exportStar(require("./demo"), exports);
27
27
  __exportStar(require("./ThemeContext"), exports);
28
28
  __exportStar(require("./I18n"), exports);
29
+ __exportStar(require("./List"), exports);
29
30
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,wCAAsB;AACtB,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB;AACxB,0CAAwB;AACxB,wCAAsB;AACtB,0CAAwB;AACxB,2CAAyB;AACzB,yCAAuB;AACvB,iDAA+B;AAC/B,yCAAsB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,wCAAsB;AACtB,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB;AACxB,0CAAwB;AACxB,wCAAsB;AACtB,0CAAwB;AACxB,2CAAyB;AACzB,yCAAuB;AACvB,iDAA+B;AAC/B,yCAAsB;AACtB,yCAAsB"}
package/src/index.tsx CHANGED
@@ -9,4 +9,5 @@ export * from './utils';
9
9
  export * from './Styles';
10
10
  export * from './demo';
11
11
  export * from './ThemeContext';
12
- export * from './I18n'
12
+ export * from './I18n'
13
+ export * from './List'