Improve typing of Animated component wrappers

Summary:
Provides flow-types for callers of AnimatedScrollView etc

Changelog: [Internal] [Fixed] Fixed flow types of Animated components

Reviewed By: cpojer

Differential Revision: D20158990

fbshipit-source-id: 3d06a89086629eb9f9d2cc0f3e7a819a80456fb0
This commit is contained in:
Pieter De Baets 2020-02-28 09:27:46 -08:00 коммит произвёл Facebook Github Bot
Родитель 85696298bf
Коммит 64720ab14a
6 изменённых файлов: 40 добавлений и 13 удалений

Просмотреть файл

@ -13,9 +13,10 @@
import * as React from 'react';
const FlatList = require('../../../Lists/FlatList');
const createAnimatedComponent = require('../createAnimatedComponent');
import type {AnimatedComponentType} from '../createAnimatedComponent';
/**
* @see https://github.com/facebook/react-native/commit/b8c8562
*/
@ -25,4 +26,7 @@ const FlatListWithEventThrottle = React.forwardRef((props, ref) => (
module.exports = (createAnimatedComponent(
FlatListWithEventThrottle,
): $FlowFixMe);
): AnimatedComponentType<
React.ElementConfig<typeof FlatList>,
React.ElementRef<typeof FlatList>,
>);

Просмотреть файл

@ -10,8 +10,16 @@
'use strict';
const Image = require('../../../Image/Image');
import * as React from 'react';
const Image = require('../../../Image/Image');
const createAnimatedComponent = require('../createAnimatedComponent');
module.exports = (createAnimatedComponent(Image): $FlowFixMe);
import type {AnimatedComponentType} from '../createAnimatedComponent';
module.exports = (createAnimatedComponent(
(Image: $FlowFixMe),
): AnimatedComponentType<
React.ElementConfig<typeof Image>,
React.ElementRef<typeof Image>,
>);

Просмотреть файл

@ -13,9 +13,10 @@
import * as React from 'react';
const ScrollView = require('../../../Components/ScrollView/ScrollView');
const createAnimatedComponent = require('../createAnimatedComponent');
import type {AnimatedComponentType} from '../createAnimatedComponent';
/**
* @see https://github.com/facebook/react-native/commit/b8c8562
*/
@ -25,4 +26,7 @@ const ScrollViewWithEventThrottle = React.forwardRef((props, ref) => (
module.exports = (createAnimatedComponent(
ScrollViewWithEventThrottle,
): $FlowFixMe);
): AnimatedComponentType<
React.ElementConfig<typeof ScrollView>,
React.ElementRef<typeof ScrollView>,
>);

Просмотреть файл

@ -13,9 +13,10 @@
import * as React from 'react';
const SectionList = require('../../../Lists/SectionList');
const createAnimatedComponent = require('../createAnimatedComponent');
import type {AnimatedComponentType} from '../createAnimatedComponent';
/**
* @see https://github.com/facebook/react-native/commit/b8c8562
*/
@ -25,4 +26,7 @@ const SectionListWithEventThrottle = React.forwardRef((props, ref) => (
module.exports = (createAnimatedComponent(
SectionListWithEventThrottle,
): $FlowFixMe);
): AnimatedComponentType<
React.ElementConfig<typeof SectionList>,
React.ElementRef<typeof SectionList>,
>);

Просмотреть файл

@ -10,8 +10,16 @@
'use strict';
const Text = require('../../../Text/Text');
import * as React from 'react';
const Text = require('../../../Text/Text');
const createAnimatedComponent = require('../createAnimatedComponent');
module.exports = (createAnimatedComponent(Text): $FlowFixMe);
import type {AnimatedComponentType} from '../createAnimatedComponent';
module.exports = (createAnimatedComponent(
(Text: $FlowFixMe),
): AnimatedComponentType<
React.ElementConfig<typeof Text>,
React.ElementRef<typeof Text>,
>);

Просмотреть файл

@ -10,12 +10,11 @@
'use strict';
import * as React from 'react';
const View = require('../../../Components/View/View');
const createAnimatedComponent = require('../createAnimatedComponent');
const React = require('react');
import type {AnimatedComponentType} from '../createAnimatedComponent';
module.exports = (createAnimatedComponent(View): AnimatedComponentType<