mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-08-15 18:45:06 +00:00
Add an API to wrap and initialize animated (#159)
This commit is contained in:
committed by
Nicolas Gallagher
parent
2c2a96a183
commit
d69406b4b1
@@ -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';
|
'use strict';
|
||||||
|
|
||||||
var Animated = require('animated');
|
var Animated = require('../../apis/Animated');
|
||||||
var EdgeInsetsPropType = require('../../apis/StyleSheet/EdgeInsetsPropType');
|
var EdgeInsetsPropType = require('../../apis/StyleSheet/EdgeInsetsPropType');
|
||||||
var NativeMethodsMixin = require('../../modules/NativeMethodsMixin');
|
var NativeMethodsMixin = require('../../modules/NativeMethodsMixin');
|
||||||
var React = require('react');
|
var React = require('react');
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
// Note (avik): add @flow when Flow supports spread properties in propTypes
|
// 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 NativeMethodsMixin = require('../../modules/NativeMethodsMixin');
|
||||||
var React = require('react');
|
var React = require('react');
|
||||||
var StyleSheet = require('../../apis/StyleSheet');
|
var StyleSheet = require('../../apis/StyleSheet');
|
||||||
|
|||||||
+2
-9
@@ -5,7 +5,7 @@ import ReactDOM from 'react-dom'
|
|||||||
import ReactDOMServer from 'react-dom/server'
|
import ReactDOMServer from 'react-dom/server'
|
||||||
|
|
||||||
// apis
|
// apis
|
||||||
import Animated from 'animated'
|
import Animated from './apis/Animated'
|
||||||
import AppRegistry from './apis/AppRegistry'
|
import AppRegistry from './apis/AppRegistry'
|
||||||
import AppState from './apis/AppState'
|
import AppState from './apis/AppState'
|
||||||
import AsyncStorage from './apis/AsyncStorage'
|
import AsyncStorage from './apis/AsyncStorage'
|
||||||
@@ -43,8 +43,6 @@ import ColorPropType from './apis/StyleSheet/ColorPropType'
|
|||||||
import EdgeInsetsPropType from './apis/StyleSheet/EdgeInsetsPropType'
|
import EdgeInsetsPropType from './apis/StyleSheet/EdgeInsetsPropType'
|
||||||
import PointPropType from './apis/StyleSheet/PointPropType'
|
import PointPropType from './apis/StyleSheet/PointPropType'
|
||||||
|
|
||||||
Animated.inject.FlattenStyle(StyleSheet.flatten)
|
|
||||||
|
|
||||||
const ReactNative = {
|
const ReactNative = {
|
||||||
// top-level API
|
// top-level API
|
||||||
findNodeHandle,
|
findNodeHandle,
|
||||||
@@ -55,12 +53,7 @@ const ReactNative = {
|
|||||||
renderToString: ReactDOMServer.renderToString,
|
renderToString: ReactDOMServer.renderToString,
|
||||||
|
|
||||||
// apis
|
// apis
|
||||||
Animated: {
|
Animated,
|
||||||
...Animated,
|
|
||||||
Image: Animated.createAnimatedComponent(Image),
|
|
||||||
Text: Animated.createAnimatedComponent(Text),
|
|
||||||
View: Animated.createAnimatedComponent(View)
|
|
||||||
},
|
|
||||||
AppRegistry,
|
AppRegistry,
|
||||||
AppState,
|
AppState,
|
||||||
AsyncStorage,
|
AsyncStorage,
|
||||||
|
|||||||
Reference in New Issue
Block a user