mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Resolve react flow definitions
Summary:Currently, we're not taking advantage of Flow's built-in type definitions for the React library in all cases because Flow's definition uses `declare module react` and this file uses `import('React')`, which Flow thinks is a different library. After this change, the following starts working which didn't before:
```js
import { Component } from 'react-native';
class MyText extends Component<void, {text: string}, void> {
render() { return <Text>{this.props.text}</Text> }
}
// Correctly throws a Flow error for the missing "text" prop
const renderedText = <MyText />;
```
Closes https://github.com/facebook/react-native/pull/5489
Differential Revision: D2856176
fb-gh-sync-id: 473ca188ad7d990c3e765526c4b33caf49ad9ffd
shipit-source-id: 473ca188ad7d990c3e765526c4b33caf49ad9ffd
This commit is contained in:
committed by
facebook-github-bot-9
parent
6b80f11652
commit
2d921eeb70
@@ -98,6 +98,7 @@ function isGameOver(gameString: string): boolean {
|
||||
}
|
||||
|
||||
class Cell extends React.Component {
|
||||
props: any;
|
||||
cellStyle() {
|
||||
switch (this.props.player) {
|
||||
case 'X':
|
||||
@@ -207,6 +208,9 @@ function GameReducer(lastGame: ?string, action: Object): string {
|
||||
}
|
||||
|
||||
class NavigationTicTacToeExample extends React.Component {
|
||||
static GameView = TicTacToeGame;
|
||||
static GameReducer = GameReducer;
|
||||
static GameActions = GameActions;
|
||||
render() {
|
||||
return (
|
||||
<NavigationRootContainer
|
||||
@@ -222,9 +226,6 @@ class NavigationTicTacToeExample extends React.Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
NavigationTicTacToeExample.GameView = TicTacToeGame;
|
||||
NavigationTicTacToeExample.GameReducer = GameReducer;
|
||||
NavigationTicTacToeExample.GameActions = GameActions;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
closeButton: {
|
||||
|
||||
Reference in New Issue
Block a user