私は核種と反応したネイティブプロジェクトでフロー0.42.0を使用しています。デフォルトのプロジェクトではStyleSheet.create "流れに覆われていません"
、私は次のメッセージが出ます:次のエラーとともに
を:
> flow check
index.ios.js:40
40: <View style={style.container}>
^^^^^^^^^ property `container`. Property cannot be accessed on possibly undefined value
40: <View style={style.container}>
^^^^^ undefined
index.ios.js:40
40: <View style={style.container}>
^^^^^^^^^ property `container`. Property not found in
40: <View style={style.container}>
^^^^^ Array
index.ios.js:41
41: <Text style={style.welcome}>
^^^^^^^ property `welcome`. Property cannot be accessed on possibly undefined value
41: <Text style={style.welcome}>
^^^^^ undefined
index.ios.js:41
41: <Text style={style.welcome}>
^^^^^^^ property `welcome`. Property not found in
41: <Text style={style.welcome}>
^^^^^ Array
index.ios.js:44
44: <Text style={style.instructions}>
^^^^^^^^^^^^ property `instructions`. Property cannot be accessed on possibly undefined value
44: <Text style={style.instructions}>
^^^^^ undefined
index.ios.js:44
44: <Text style={style.instructions}>
^^^^^^^^^^^^ property `instructions`. Property not found in
44: <Text style={style.instructions}>
^^^^^ Array
index.ios.js:47
47: <Text style={style.instructions}>
^^^^^^^^^^^^ property `instructions`. Property cannot be accessed on possibly undefined value
47: <Text style={style.instructions}>
^^^^^ undefined
index.ios.js:47
47: <Text style={style.instructions}>
^^^^^^^^^^^^ property `instructions`. Property not found in
47: <Text style={style.instructions}>
^^^^^ Array
Found 8 errors
この問題(https://github.com/flowtype/flow-typed/issues/631は)正しいタイプだったことを示唆しているように見えましたStyleSheet.Styles
ですが、それは私に同じメッセージ(上記と同じエラー)を与えます:
ここで適切なフロータイピングができる方法はありますか?参考のため
、完全なファイルは次のとおりです。
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
export default class PartalkReact extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.ios.js
</Text>
<Text style={styles.instructions}>
Press Cmd+R to reload,{'\n'}
Cmd+D or shake for dev menu
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('PartalkReact',() => PartalkReact);
編集 0.45.0を流れるようにアップグレードした後、コメントどおり、私はもはや私のファイルに問題を抱えているが、反応自体はで失敗しません次のエラーが発生しました:https://pastebin.com/raw/Ngpagayi
しかし、インクルードは、ネイティブソースが 'create'機能に流れタイピングを持って反応します。 https://github.com/facebook/react-native/blob/master/Libraries/StyleSheet/StyleSheet.js –
も参照してください。また、作成機能にcmd +クリックすることはできないようですそのフローは何らかの理由で反応したネイティブソースを解析していません。 –
編集内容をご覧ください。 – Codesingh