Add constructor for section type in VirtualizedSectionList by sgny · Pull Request #614 · rescript-react-native/rescript-react-native
Should close #605
Notes on implementation:
sectionneeds to be consumed as well as constructed, therefore I added a constructor after the type definition. This works without any issues, as tested for this case but also from prior experience.- To avoid confusion with
extraData, I chose the namemoreFields. - If the additional key
moreFieldswas another parameter ('moreFields), thensectionwould need to be typed assection('item, 'moreFields)which necessitates specifying'moreFieldswhen creatingsection- if the key is not used. To avoid such unnecessary complexity, I chose to define amoreFieldstype instead and added a function to cast anything as that type.
sgny
mentioned this pull request
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
I would just find a more explicit name for moreFields, maybe something like additionalSectionData or just additionalData
MoOx approved these changes Sep 26, 2019
MoOx
deleted the
sectionList
branch
sgny
mentioned this pull request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters