滑动式-card.js:
render() {
const {
children, containerStyle, revealContainerStyle, rightSwipeContent,
} = this.props;
const swipeAnimStyle = {
right: this.swipeAnim,
};
const childrenWithProps = React.Children.map(children, child => React.cloneElement(child, {
swipeLeftPanResponder: this.swipeLeftPanResponder,
}));
return (
<View style={[styles.container, containerStyle]}>
<Animated.View style={[styles.swipedSection, swipeAnimStyle]}>
{childrenWithProps}
</Animated.View>
<View
style={[styles.revealedContainer, revealContainerStyle]}
>
{rightSwipeContent()}
</View>
</View>
);
}
正在使用上述组件,如下所示:
renderStory({ item }: Object) {
const story = this.props.feeds.byId[item];
return (
<SwipeableCard
key={item}
containerStyle={styles.feedCard}
rightSwipeContent={this.renderSwipeContent(story, this.props.portfolios)}
>
<StoryCard story={story} onStoryPress={this.onStoryPress(item)} />
</SwipeableCard>
);
}
.flowconfig.js
[ignore]
; We fork some components by platform
.*/*[.]android.js
; Ignore React Navigation
.*/node_modules/react-navigation/.*
; Ignore React Native Tab View
.*/node_modules/react-native-tab-view/.*
; Ignore React Native Loading Placeholder
.*/node_modules/react-native-loading-placeholder/.*
; Ignore React Native Linear Gradient
.*/node_modules/react-native-linear-gradient/.*
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*
; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
; Ignore polyfills
.*/Libraries/polyfills/.*
; Ignore React Native
<PROJECT_ROOT>/node_modules/react-native/.*
<PROJECT_ROOT>/node_modules/expo/.*
; Ignore project JSON files
<PROJECT_ROOT>/tools/resources/.*
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/
node_modules/expo/flow/
flow-typed
[options]
emoji=true
module.file_ext=.css
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.system=haste
munge_underscores=true
module.name_mapper='^src' -> '<PROJECT_ROOT>/src'
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
module.name_mapper='^react-navigation$' -> 'emptyObject'
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-3]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-3]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
我收到以下代码提供的流错误消息:
无法调用
React.Children.map
,因为缺少属性map
Children
“flow-bin”:“^ 0.71.0”,
“flow-typed”:“^ 2.4.0”,
“反应”:“16.2.0”,
“react-native”:“https://github.com/expo/react-native/archive/sdk-25.0.0.tar.gz”,
答案 0 :(得分:0)
它适用于我,它是in the type definition for React。这是一个Try Link。我敢打赌,本地和全球版本的流程之间存在差异,而且您运行的是过时的版本:
yarn upgrade flow@0.70
./node_modules/.bin/flow
这应该可以运行本地版本(或在package.json
中定义任务)。