From bda9548b66fa17287e66d0b4fa17b2ec6ac6d5fa Mon Sep 17 00:00:00 2001 From: kdxcxs Date: Sat, 5 Dec 2020 17:40:14 +0800 Subject: [PATCH] refactor(YooForum): make topic list a separate function component --- src/ui/YooForumUI.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/ui/YooForumUI.js b/src/ui/YooForumUI.js index 5c91e20..6e78311 100644 --- a/src/ui/YooForumUI.js +++ b/src/ui/YooForumUI.js @@ -45,6 +45,17 @@ const styles = StyleSheet.create({ }, }); +function ForumTopic(props) { + return props.topics.map((topic, key) => ( + + )); +} + export default class YooForumUI extends Component { constructor(props) { super(props); @@ -134,14 +145,11 @@ export default class YooForumUI extends Component { this.setState({currentPosition: event.nativeEvent.contentOffset.y}) }> {this.props.hint === '' ? ( - this.props.topics.map((topic, key) => ( - - )) + ) : (