Skip to content

Commit

Permalink
Remove underscore prefixing for “private” methods in React components – 
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Cuevas committed Nov 27, 2016
1 parent e4dd234 commit 37f766d
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
10 changes: 5 additions & 5 deletions ignite-base/App/Containers/ListviewExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ class ListviewExample extends React.Component {

/* ***********************************************************
* STEP 3
* `_renderRow` function -How each cell/row should be rendered
* `renderRow` function -How each cell/row should be rendered
* It's our best practice to place a single component here:
*
* e.g.
return <MyCustomCell title={rowData.title} description={rowData.description} />
*************************************************************/
_renderRow (rowData) {
renderRow (rowData) {
return (
<View style={styles.row}>
<Text style={styles.boldLabel}>{rowData.title}</Text>
Expand Down Expand Up @@ -100,18 +100,18 @@ class ListviewExample extends React.Component {

// Used for friendly AlertMessage
// returns true if the dataSource is empty
_noRowData () {
noRowData () {
return this.state.dataSource.getRowCount() === 0
}

render () {
return (
<View style={styles.container}>
<AlertMessage title='Nothing to See Here, Move Along' show={this._noRowData()} />
<AlertMessage title='Nothing to See Here, Move Along' show={this.noRowData()} />
<ListView
contentContainerStyle={styles.listContent}
dataSource={this.state.dataSource}
renderRow={this._renderRow}
renderRow={this.renderRow}
pageSize={15}
/>
</View>
Expand Down
10 changes: 5 additions & 5 deletions ignite-base/App/Containers/ListviewGridExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ class ListviewGridExample extends React.Component {

/* ***********************************************************
* STEP 3
* `_renderRow` function -How each cell/row should be rendered
* `renderRow` function -How each cell/row should be rendered
* It's our best practice to place a single component here:
*
* e.g.
return <MyCustomCell title={rowData.title} description={rowData.description} />
*************************************************************/
_renderRow (rowData) {
renderRow (rowData) {
return (
<View style={styles.row}>
<Text style={styles.boldLabel}>{rowData.title}</Text>
Expand Down Expand Up @@ -101,18 +101,18 @@ class ListviewGridExample extends React.Component {

// Used for friendly AlertMessage
// returns true if the dataSource is empty
_noRowData () {
noRowData () {
return this.state.dataSource.getRowCount() === 0
}

render () {
return (
<View style={styles.container}>
<AlertMessage title='Nothing to See Here, Move Along' show={this._noRowData()} />
<AlertMessage title='Nothing to See Here, Move Along' show={this.noRowData()} />
<ListView
contentContainerStyle={styles.listContent}
dataSource={this.state.dataSource}
renderRow={this._renderRow}
renderRow={this.renderRow}
pageSize={15}
/>
</View>
Expand Down
10 changes: 5 additions & 5 deletions ignite-base/App/Containers/ListviewSearchingExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ class ListviewExample extends React.Component {
}

/* ***********************************************************
* `_renderRow` function -How each cell/row should be rendered
* `renderRow` function -How each cell/row should be rendered
* It's our best practice to place a single component here:
*
* e.g.
return <MyCustomCell title={rowData.title} description={rowData.description} />
*************************************************************/
_renderRow (searchTerm) {
renderRow (searchTerm) {
return (
<View style={styles.row}>
<Text style={styles.boldLabel}>{searchTerm}</Text>
Expand All @@ -65,18 +65,18 @@ class ListviewExample extends React.Component {

// Used for friendly AlertMessage
// returns true if the dataSource is empty
_noRowData () {
noRowData () {
return this.state.dataSource.getRowCount() === 0
}

render () {
return (
<View style={styles.container}>
<AlertMessage title='Nothing to See Here, Move Along' show={this._noRowData()} />
<AlertMessage title='Nothing to See Here, Move Along' show={this.noRowData()} />
<ListView
contentContainerStyle={styles.listContent}
dataSource={this.state.dataSource}
renderRow={this._renderRow}
renderRow={this.renderRow}
pageSize={15}
enableEmptySections
/>
Expand Down
14 changes: 7 additions & 7 deletions ignite-base/App/Containers/ListviewSectionsExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ class ListviewSectionsExample extends React.Component {

/* ***********************************************************
* STEP 3
* `_renderRow` function -How each cell/row should be rendered
* `renderRow` function -How each cell/row should be rendered
* It's our best practice to place a single component here:
*
* e.g.
return <MyCustomCell title={rowData.title} description={rowData.description} />
*************************************************************/
_renderRow (rowData, sectionID) {
renderRow (rowData, sectionID) {
// You can condition on sectionID (key as string), for different cells
// in different sections
return (
Expand Down Expand Up @@ -109,11 +109,11 @@ class ListviewSectionsExample extends React.Component {

// Used for friendly AlertMessage
// returns true if the dataSource is empty
_noRowData () {
noRowData () {
return this.state.dataSource.getRowCount() === 0
}

_renderHeader (data, sectionID) {
renderHeader (data, sectionID) {
switch (sectionID) {
case 'first':
return <Text style={styles.boldLabel}>First Section</Text>
Expand All @@ -125,12 +125,12 @@ class ListviewSectionsExample extends React.Component {
render () {
return (
<View style={styles.container}>
<AlertMessage title='Nothing to See Here, Move Along' show={this._noRowData()} />
<AlertMessage title='Nothing to See Here, Move Along' show={this.noRowData()} />
<ListView
renderSectionHeader={this._renderHeader}
renderSectionHeader={this.renderHeader}
contentContainerStyle={styles.listContent}
dataSource={this.state.dataSource}
renderRow={this._renderRow}
renderRow={this.renderRow}
enableEmptySections
/>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ class ListviewSectionsExample extends React.Component {

/* ***********************************************************
* STEP 3
* `_renderRow` function -How each cell/row should be rendered
* `renderRow` function -How each cell/row should be rendered
* It's our best practice to place a single component here:
*
* e.g.
return <MyCustomCell title={rowData.title} description={rowData.description} />
*************************************************************/
_renderRow (rowData, sectionID) {
renderRow (rowData, sectionID) {
// You can condition on sectionID (key as string), for different cells
// in different sections
return (
Expand Down Expand Up @@ -109,11 +109,11 @@ class ListviewSectionsExample extends React.Component {

// Used for friendly AlertMessage
// returns true if the dataSource is empty
_noRowData () {
noRowData () {
return this.state.dataSource.getRowCount() === 0
}

_renderHeader (data, sectionID) {
renderHeader (data, sectionID) {
switch (sectionID) {
case 'first':
return <Text style={styles.boldLabel}>First Section</Text>
Expand All @@ -125,13 +125,13 @@ class ListviewSectionsExample extends React.Component {
render () {
return (
<View style={styles.container}>
<AlertMessage title='Nothing to See Here, Move Along' show={this._noRowData()} />
<AlertMessage title='Nothing to See Here, Move Along' show={this.noRowData()} />
<ListView
renderSectionHeader={this._renderHeader}
renderSectionHeader={this.renderHeader}
contentContainerStyle={styles.listContent}
dataSource={this.state.dataSource}
onLayout={this.onLayout}
renderRow={this._renderRow}
renderRow={this.renderRow}
enableEmptySections
/>
</View>
Expand Down
14 changes: 7 additions & 7 deletions ignite-generator/listview/templates/listview.js.template
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ class <%= name %> extends React.Component {

/* ***********************************************************
* STEP 3
* `_renderRow` function -How each cell/row should be rendered
* `renderRow` function -How each cell/row should be rendered
* It's our best practice to place a single component here:
*
* e.g.
return <MyCustomCell title={rowData.title} description={rowData.description} />
*************************************************************/
_renderRow (rowData) {
renderRow (rowData) {
return (
<View style={styles.row}>
<Text style={styles.boldLabel}>{rowData.title}</Text>
Expand Down Expand Up @@ -90,12 +90,12 @@ class <%= name %> extends React.Component {

// Used for friendly AlertMessage
// returns true if the dataSource is empty
_noRowData () {
noRowData () {
return this.state.dataSource.getRowCount() === 0
}

// Render a footer.
_renderFooter = () => {
renderFooter = () => {
return (
<Text> - Footer - </Text>
)
Expand All @@ -104,12 +104,12 @@ class <%= name %> extends React.Component {
render () {
return (
<View style={styles.container}>
<AlertMessage title='Nothing to See Here, Move Along' show={this._noRowData()} />
<AlertMessage title='Nothing to See Here, Move Along' show={this.noRowData()} />
<ListView
contentContainerStyle={styles.listContent}
dataSource={this.state.dataSource}
renderRow={this._renderRow}
renderFooter={this._renderFooter}
renderRow={this.renderRow}
renderFooter={this.renderFooter}
enableEmptySections
pageSize={15}
/>
Expand Down

0 comments on commit 37f766d

Please sign in to comment.