Animated: Create Components Lazily

Summary: Changes `Animated` so that the convenience components are lazily initialized.

Reviewed By: TheSavior

Differential Revision: D9394785

fbshipit-source-id: 1a2c9a9af500c02d6c91ccb5ddff341c94b17bd1
This commit is contained in:
Tim Yung 2018-08-20 14:04:30 -07:00 committed by Facebook Github Bot
parent 139559fc07
commit 322d0e00e2
7 changed files with 121 additions and 13 deletions

View File

@ -4,26 +4,32 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @flow
* @format
*/
'use strict';
const AnimatedImplementation = require('AnimatedImplementation');
const FlatList = require('FlatList');
const Image = require('Image');
const ScrollView = require('ScrollView');
const SectionList = require('SectionList');
const Text = require('Text');
const View = require('View');
module.exports = {
get FlatList() {
return require('AnimatedFlatList');
},
get Image() {
return require('AnimatedImage');
},
get ScrollView() {
return require('AnimatedScrollView');
},
get SectionList() {
return require('AnimatedSectionList');
},
get Text() {
return require('AnimatedText');
},
get View() {
return require('AnimatedView');
},
...AnimatedImplementation,
View: AnimatedImplementation.createAnimatedComponent(View),
Text: AnimatedImplementation.createAnimatedComponent(Text),
Image: AnimatedImplementation.createAnimatedComponent(Image),
ScrollView: AnimatedImplementation.createAnimatedComponent(ScrollView),
FlatList: AnimatedImplementation.createAnimatedComponent(FlatList),
SectionList: AnimatedImplementation.createAnimatedComponent(SectionList),
};

View File

@ -0,0 +1,17 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
'use strict';
const FlatList = require('FlatList');
const createAnimatedComponent = require('createAnimatedComponent');
module.exports = createAnimatedComponent(FlatList);

View File

@ -0,0 +1,17 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
'use strict';
const Image = require('Image');
const createAnimatedComponent = require('createAnimatedComponent');
module.exports = createAnimatedComponent(Image);

View File

@ -0,0 +1,17 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
'use strict';
const ScrollView = require('ScrollView');
const createAnimatedComponent = require('createAnimatedComponent');
module.exports = createAnimatedComponent(ScrollView);

View File

@ -0,0 +1,17 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
'use strict';
const SectionList = require('SectionList');
const createAnimatedComponent = require('createAnimatedComponent');
module.exports = createAnimatedComponent(SectionList);

View File

@ -0,0 +1,17 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
'use strict';
const Text = require('Text');
const createAnimatedComponent = require('createAnimatedComponent');
module.exports = createAnimatedComponent(Text);

View File

@ -0,0 +1,17 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
'use strict';
const View = require('View');
const createAnimatedComponent = require('createAnimatedComponent');
module.exports = createAnimatedComponent(View);