[react_native] JS files from D2001635: [react_native] Use hardware layers during adsmanager Navigator navigation

This commit is contained in:
Andy Street
2015-04-21 04:14:17 -07:00
parent 765779a4bd
commit b0348edcae
2 changed files with 62 additions and 0 deletions

View File

@@ -138,6 +138,37 @@ var NavigatorBreadcrumbNavigationBar = React.createClass({
}
},
onAnimationStart: function(fromIndex, toIndex) {
var max = Math.max(fromIndex, toIndex);
var min = Math.min(fromIndex, toIndex);
for (var index = min; index <= max; index++) {
this._setRenderViewsToHardwareTextureAndroid(index, true);
}
},
onAnimationEnd: function(fromIndex, toIndex) {
var max = Math.max(fromIndex, toIndex);
var min = Math.min(fromIndex, toIndex);
for (var index = min; index <= max; index++) {
this._setRenderViewsToHardwareTextureAndroid(index, false);
}
},
_setRenderViewsToHardwareTextureAndroid: function(index, renderToHardwareTexture) {
var props = {
renderToHardwareTextureAndroid: renderToHardwareTexture,
};
this.refs['crumb_' + index].setNativeProps(props);
this.refs['icon_' + index].setNativeProps(props);
this.refs['separator_' + index].setNativeProps(props);
this.refs['title_' + index].setNativeProps(props);
var right = this.refs['right_' + index];
if (right) {
right.setNativeProps(props);
}
},
render: function() {
var navState = this.props.navState;
var icons = navState && navState.routeStack.map(this._renderOrReturnBreadcrumb);