From c094a156d6d61c07eb4fed503311d8080e46a996 Mon Sep 17 00:00:00 2001 From: Andy Street Date: Tue, 2 Jun 2015 07:22:19 -0700 Subject: [PATCH] [react_native] JS files from D2036695: [ReactNative] Implement new transform API on Android --- Examples/UIExplorer/TransformExample.js | 159 ++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 Examples/UIExplorer/TransformExample.js diff --git a/Examples/UIExplorer/TransformExample.js b/Examples/UIExplorer/TransformExample.js new file mode 100644 index 000000000..a59a019b3 --- /dev/null +++ b/Examples/UIExplorer/TransformExample.js @@ -0,0 +1,159 @@ +/** + * Copyright 2004-present Facebook. All Rights Reserved. + * + * @providesModule TransformExample + */ +'use strict'; + +var React = require('React'); + +var StyleSheet = require('StyleSheet'); +var TimerMixin = require('react-timer-mixin'); +var UIExplorerBlock = require('UIExplorerBlock'); +var UIExplorerPage = require('UIExplorerPage'); +var View = require('View'); + +var TransformExample = React.createClass({ + + mixins: [TimerMixin], + + getInitialState() { + return { + interval: this.setInterval(this._update, 800), + pulse: false, + }; + }, + + render() { + return ( + + + + + + + + + + + + + + ); + }, + + _update() { + this.setState({ + pulse: !this.state.pulse, + }); + }, + +}); + +var styles = StyleSheet.create({ + box1: { + left: 0, + backgroundColor: 'green', + height: 50, + position: 'absolute', + top: 0, + transform: [ + {translateX: 100}, + {translateY: 50}, + {rotate: '30deg'}, + {scaleX: 2}, + {scaleY: 2}, + ], + width: 50, + }, + box2: { + left: 0, + backgroundColor: 'purple', + height: 50, + position: 'absolute', + top: 0, + transform: [ + {scaleX: 2}, + {scaleY: 2}, + {translateX: 100}, + {translateY: 50}, + {rotate: '30deg'}, + ], + width: 50, + }, + box3step1: { + left: 0, + backgroundColor: '#ffb6c1', // lightpink + height: 50, + position: 'absolute', + top: 0, + transform: [ + {rotate: '30deg'}, + ], + width: 50, + }, + box3step2: { + left: 0, + backgroundColor: '#ff69b4', //hotpink + height: 50, + opacity: 0.5, + position: 'absolute', + top: 0, + transform: [ + {rotate: '30deg'}, + {scaleX: 2}, + {scaleY: 2}, + ], + width: 50, + }, + box3step3: { + left: 0, + backgroundColor: '#ff1493', // deeppink + height: 50, + opacity: 0.5, + position: 'absolute', + top: 0, + transform: [ + {rotate: '30deg'}, + {scaleX: 2}, + {scaleY: 2}, + {translateX: 100}, + {translateY: 50}, + ], + width: 50, + }, + box4: { + left: 0, + backgroundColor: '#ff8c00', // darkorange + height: 50, + position: 'absolute', + top: 0, + transform: [ + {translate: [200, 350]}, + {scale: 2.5}, + {rotate: '-0.2rad'}, + ], + width: 100, + }, + box5: { + backgroundColor: '#800000', // maroon + height: 50, + position: 'absolute', + right: 0, + top: 0, + width: 50, + }, + box5Transform: { + transform: [ + {translate: [-50, 35]}, + {rotate: '50deg'}, + {scale: 2}, + ], + }, +}); + + +module.exports = TransformExample;