16
16
17
17
## Contents
18
18
19
- * [ Features] ( #features )
20
- * [ Installation] ( #installation )
21
- * [ Styles] ( #supported-styles )
22
- * [ Examples] ( #examples )
23
- * [ Customization] ( #customization )
19
+ - [ Features] ( #features )
20
+ - [ Installation] ( #installation )
21
+ - [ Styles] ( #supported-styles )
22
+ - [ Examples] ( #examples )
23
+ - [ Customization] ( #customization )
24
24
25
25
## Features
26
26
27
- * Look and feel of iOS TableView - ** because it is!** (with group/plain
27
+ - Look and feel of iOS TableView - ** because it is!** (with group/plain
28
28
tableview type, sections headers, etc)
29
- * Display long lists of data (like country list) with no performance loss
30
- * Built-in accessory types (checkmark or disclosure indicator)
31
- * Pull to refresh!
32
- * Automatic scroll to initial selected value during component initialization
29
+ - Display long lists of data (like country list) with no performance loss
30
+ - Built-in accessory types (checkmark or disclosure indicator)
31
+ - Pull to refresh!
32
+ - Automatic scroll to initial selected value during component initialization
33
33
(autoFocus property)
34
- * Automatic item selection with "checkmark" with old item de-selection
34
+ - Automatic item selection with "checkmark" with old item de-selection
35
35
(optionally), see demo, useful to select country/state/etc.
36
- * Render Native Section Index Titles (sectionIndexTitlesEnabled property)
37
- * Native JSON support for datasource. If you need to display large dataset,
36
+ - Render Native Section Index Titles (sectionIndexTitlesEnabled property)
37
+ - Native JSON support for datasource. If you need to display large dataset,
38
38
generated Javascript will became very large and impact js loading time. To
39
39
solve this problem the component could read JSON directly from app bundle
40
40
without JS!
41
- * Filter JSON datasources using NSPredicate syntax. For example you could select
41
+ - Filter JSON datasources using NSPredicate syntax. For example you could select
42
42
states for given country only (check demo)
43
- * Create custom UITableView cells with flexible height using React Native syntax
43
+ - Create custom UITableView cells with flexible height using React Native syntax
44
44
(TableView.Cell tag)
45
- * Use TableView as menu to navigate to other screens (check included demo, using
45
+ - Use TableView as menu to navigate to other screens (check included demo, using
46
46
react-navigation https://reactnavigation.org )
47
- * Native editing mode for table - move/delete option is supported by using
47
+ - Native editing mode for table - move/delete option is supported by using
48
48
attributes canMove, canEdit for items/sections
49
49
50
50
## Installation
51
51
52
52
1 . Installation
53
- * Using npm: ` npm install react-native-tableview --save `
54
- * Using yarn: ` yarn add react-native-tableview `
53
+ - Using npm: ` npm install react-native-tableview --save `
54
+ - Using yarn: ` yarn add react-native-tableview `
55
55
2 . Link
56
- * ` react-native link react-native-tableview `
57
- * If fails, follow manual linking steps below
56
+ - ` react-native link react-native-tableview `
57
+ - If fails, follow manual linking steps below
58
58
3 . (optional) If you will use JSON file, add it to iOS application bundle
59
59
4 . Import it in your JS:
60
60
61
61
``` js
62
- import TableView from ' react-native-tableview'
62
+ import TableView from ' react-native-tableview' ;
63
63
```
64
64
65
65
### Manual Linking
70
70
3 . In the XCode project navigator, select your project, select the Build Phases
71
71
tab and in the Link Binary With Libraries section add libRNTableView.a
72
72
4 . And in the Build Settings tab in the Search Paths/Header Search Paths section
73
- add $(SRCROOT)/../node_modules/react-native-tableview (make sure it's
73
+ add \ $ (SRCROOT)/../node_modules/react-native-tableview (make sure it's
74
74
recursive).
75
75
76
76
## Supported Styles
@@ -137,7 +137,6 @@ Checkmark can also be applied by adding the `selected` prop on the Item.
137
137
For a full list of props on all components check out
138
138
[ the typescript definitions file] ( ./src/index.d.ts ) .
139
139
140
-
141
140
### Methods
142
141
143
142
#### ` scrollTo() `
@@ -230,7 +229,7 @@ render() {
230
229
``` jsx
231
230
// list spanish provinces and add 'All states' item at the beginning
232
231
233
- const country = ' ES'
232
+ const country = ' ES' ;
234
233
235
234
return (
236
235
< View style= {{ flex: 1 }}>
@@ -244,7 +243,7 @@ return (
244
243
onPress= {event => alert (JSON .stringify (event ))}
245
244
/ >
246
245
< / View>
247
- )
246
+ );
248
247
```
249
248
250
249
### Built-in editing
@@ -340,53 +339,53 @@ render() {
340
339
341
340
The following style props are supported:
342
341
343
- * ` tableViewCellStyle `
344
- * ` tableViewCellEditingStyle `
345
- * ` separatorStyle `
346
- * ` contentInset `
347
- * ` contentOffset `
348
- * ` scrollIndicatorInsets `
349
- * ` cellLayoutMargins `
350
- * ` cellSeparatorInset `
342
+ - ` tableViewCellStyle `
343
+ - ` tableViewCellEditingStyle `
344
+ - ` separatorStyle `
345
+ - ` contentInset `
346
+ - ` contentOffset `
347
+ - ` scrollIndicatorInsets `
348
+ - ` cellLayoutMargins `
349
+ - ` cellSeparatorInset `
351
350
352
351
Colors:
353
352
354
- * ` textColor `
355
- * ` tintColor `
356
- * ` selectedTextColor `
357
- * ` detailTextColor `
358
- * ` separatorColor `
359
- * ` headerTextColor `
360
- * ` headerBackgroundColor `
361
- * ` footerTextColor `
353
+ - ` textColor `
354
+ - ` tintColor `
355
+ - ` selectedTextColor `
356
+ - ` detailTextColor `
357
+ - ` separatorColor `
358
+ - ` headerTextColor `
359
+ - ` headerBackgroundColor `
360
+ - ` footerTextColor `
362
361
363
362
Base font:
364
363
365
- * ` fontSize `
366
- * ` fontWeight `
367
- * ` fontStyle `
368
- * ` fontFamily `
364
+ - ` fontSize `
365
+ - ` fontWeight `
366
+ - ` fontStyle `
367
+ - ` fontFamily `
369
368
370
369
"Subtitle" font:
371
370
372
- * ` detailFontSize `
373
- * ` detailFontWeight `
374
- * ` detailFontStyle `
375
- * ` detailFontFamily `
371
+ - ` detailFontSize `
372
+ - ` detailFontWeight `
373
+ - ` detailFontStyle `
374
+ - ` detailFontFamily `
376
375
377
376
Header font:
378
377
379
- * ` headerFontSize `
380
- * ` headerFontWeight `
381
- * ` headerFontStyle `
382
- * ` headerFontFamily `
378
+ - ` headerFontSize `
379
+ - ` headerFontWeight `
380
+ - ` headerFontStyle `
381
+ - ` headerFontFamily `
383
382
384
383
Footer font:
385
384
386
- * ` footerFontSize `
387
- * ` footerFontWeight `
388
- * ` footerFontStyle `
389
- * ` footerFontFamily `
385
+ - ` footerFontSize `
386
+ - ` footerFontWeight `
387
+ - ` footerFontStyle `
388
+ - ` footerFontFamily `
390
389
391
390
## Images / Icons
392
391
@@ -396,14 +395,14 @@ An `image` prop can be a string pointing to the name of an asset in your "Asset
396
395
Catalog". In this case an ` imageWidth ` prop is recommended.
397
396
398
397
``` jsx
399
- ; < Item image= " icon-success.png" imageWidth= {40 } / >
398
+ < Item image= " icon-success.png" imageWidth= {40 } / > ;
400
399
```
401
400
402
401
Alternatively, you can ` require ` the image from your local app code. In this case
403
402
an ` imageWidth ` is unnecessary.
404
403
405
404
``` jsx
406
- ; < Item image= {require (' ../images/icon-success.png' )} / >
405
+ < Item image= {require (' ../images/icon-success.png' )} / > ;
407
406
```
408
407
409
408
### Editable Complex Components
@@ -449,24 +448,25 @@ For example,
449
448
450
449
class TableViewExampleCell extends React.Component {
451
450
render() {
452
- var style = { borderColor: '#aaaaaa', borderWidth: 1, borderRadius: 3 }
451
+ var style = { borderColor: '#aaaaaa', borderWidth: 1, borderRadius: 3 };
453
452
454
453
// Fill the full native table cell height.
455
- style.flex = 1
454
+ style.flex = 1;
456
455
457
456
// All Item props get passed to this cell inside this.props.data. Use them to control the rendering, for example background color:
458
457
if (this.props.data.backgroundColor !== undefined) {
459
- style.backgroundColor = this.props.data.backgroundColor
458
+ style.backgroundColor = this.props.data.backgroundColor;
460
459
}
461
460
462
461
return (
463
462
<View style={style}>
464
463
<Text>
465
- section:{this.props.section},row:{this.props.row},label:{this.props.data.label}
464
+ section:{this.props.section},row:{this.props.row},label:
465
+ {this.props.data.label}
466
466
</Text>
467
467
<Text> message:{this.props.data.message}</Text>
468
468
</View>
469
- )
469
+ );
470
470
}
471
471
}
472
472
```
@@ -482,17 +482,17 @@ For more examples, see examples/TableViewDemo.
482
482
#### Create list of items, passing props
483
483
484
484
``` jsx
485
- ; < Section canEdit= {true }>
485
+ < Section canEdit= {true }>
486
486
{this .props .items .map (function (item ) {
487
487
return (
488
488
< Item
489
489
key= {' i' + item .data .date }
490
490
label= {item .label }
491
491
message= {item .message }
492
492
/ >
493
- )
493
+ );
494
494
})}
495
- < / Section>
495
+ < / Section> ;
496
496
```
497
497
498
498
Note that the props you pass must be primitive types: they cannot be objects.
0 commit comments