mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-01-12 22:51:09 +08:00
Add an API to wrap and initialize animated (#159)
This commit is contained in:
committed by
Nicolas Gallagher
parent
2c2a96a183
commit
d69406b4b1
14
src/apis/Animated/index.js
Normal file
14
src/apis/Animated/index.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import Animated from 'animated'
|
||||
import StyleSheet from '../StyleSheet'
|
||||
import Image from '../../components/Image'
|
||||
import Text from '../../components/Text'
|
||||
import View from '../../components/View'
|
||||
|
||||
Animated.inject.FlattenStyle(StyleSheet.flatten)
|
||||
|
||||
module.exports = {
|
||||
...Animated,
|
||||
Image: Animated.createAnimatedComponent(Image),
|
||||
Text: Animated.createAnimatedComponent(Text),
|
||||
View: Animated.createAnimatedComponent(View)
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var Animated = require('animated');
|
||||
var Animated = require('../../apis/Animated');
|
||||
var EdgeInsetsPropType = require('../../apis/StyleSheet/EdgeInsetsPropType');
|
||||
var NativeMethodsMixin = require('../../modules/NativeMethodsMixin');
|
||||
var React = require('react');
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
// Note (avik): add @flow when Flow supports spread properties in propTypes
|
||||
|
||||
var Animated = require('animated');
|
||||
var Animated = require('../../apis/Animated');
|
||||
var NativeMethodsMixin = require('../../modules/NativeMethodsMixin');
|
||||
var React = require('react');
|
||||
var StyleSheet = require('../../apis/StyleSheet');
|
||||
|
||||
11
src/index.js
11
src/index.js
@@ -5,7 +5,7 @@ import ReactDOM from 'react-dom'
|
||||
import ReactDOMServer from 'react-dom/server'
|
||||
|
||||
// apis
|
||||
import Animated from 'animated'
|
||||
import Animated from './apis/Animated'
|
||||
import AppRegistry from './apis/AppRegistry'
|
||||
import AppState from './apis/AppState'
|
||||
import AsyncStorage from './apis/AsyncStorage'
|
||||
@@ -43,8 +43,6 @@ import ColorPropType from './apis/StyleSheet/ColorPropType'
|
||||
import EdgeInsetsPropType from './apis/StyleSheet/EdgeInsetsPropType'
|
||||
import PointPropType from './apis/StyleSheet/PointPropType'
|
||||
|
||||
Animated.inject.FlattenStyle(StyleSheet.flatten)
|
||||
|
||||
const ReactNative = {
|
||||
// top-level API
|
||||
findNodeHandle,
|
||||
@@ -55,12 +53,7 @@ const ReactNative = {
|
||||
renderToString: ReactDOMServer.renderToString,
|
||||
|
||||
// apis
|
||||
Animated: {
|
||||
...Animated,
|
||||
Image: Animated.createAnimatedComponent(Image),
|
||||
Text: Animated.createAnimatedComponent(Text),
|
||||
View: Animated.createAnimatedComponent(View)
|
||||
},
|
||||
Animated,
|
||||
AppRegistry,
|
||||
AppState,
|
||||
AsyncStorage,
|
||||
|
||||
Reference in New Issue
Block a user