React-native – use separator React Native NativeBase ListView

I currently use React Native’s ListView to display a list with section headers (renderSectionHeader):

 dataSource={this.state.dataSource}
renderRow={(rowData) => }
renderSectionHeader={(sectionData, sectionId) => )
/>

dataSource contains an object Array, which contains the section header in the key, and an array of list items, such a value

{
Section 1: [{firstName:'A', lastName:'B'}, {firstName:'C', lastName:'D'}],
Section 2: [{firstName:'E', lastName:'F'}, {firstName:'G', lastName:'H'}]
}

I want to know if I can use NativeBase The List component implements the same (and has a better-looking layout). However, I can’t find any information on how to pass in the section title:



{data}

} />

< p>Is this possible, and if so, are there any disadvantages of using it instead of React Native’s ListView?

In theory, NativeBase’s List should accept the props supported by React Native’s ListView.

< /p>

You can use the itemHeader prop to render the section heading:


ACTION

I currently use React Native’s ListView to display a list with section headers (renderSectionHeader):

 dataSource={this.state.dataSource}
renderRow={(rowData) => }
renderSectionHeader={(sectionData, sectionId) => )
/>

dataSource contains an object Array, which contains the section header in the key, and an array of list items, such a value< /p>

{
Section 1: [{firstName:'A', lastName:'B'}, {firstName:'C', lastName:'D'}] ,
Section 2: [{firstName:'E', lastName:'F'}, {firstName:'G', lastName:'H'}]
}

I Want to know if the same can be achieved using NativeBase’s List component (and has a better-looking layout). However, I can’t find any information on how to pass in the section title:

 

{data}

} />

Is this possible, and if so, is there a ListView that uses it instead of React Native Shortcomings?

In theory, NativeBase’s List should accept the props supported by React Native’s ListView.

You can use itemHeader prop to render the section Title:


ACTION

Leave a Comment

Your email address will not be published.