Restore canvas once group has been drawn
Summary:The implementation of ARTGroupShadowNode saved the canvas and then drew the child nodes but did not reset the canvas afterwards, unlike the behaviour of the other ART shadow nodes. Because of this the matrix operations were compounded for sibling nodes in the surface. As an example the following code should draw a green circle in the bottom right corner of the surface and a red circle in the top left, which it does on iOS; on Android you'll find that the red circle is drawn in the bottom right corner instead. ``` 'use strict'; import React, { AppRegistry, Component, StyleSheet, View, } from 'react-native'; const { Surface, Group, Shape } = React.ART; const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#808080', }, surface: { backgroundColor: '#ffffff' }, }); class ARTGroupBug extends Component { render() { return ( <View style={styles.container}> < Closes https://github.com/facebook/react-native/pull/5619 Differential Revision: D2981865 Pulled By: spicyj fb-gh-sync-id: 95ca701354fe728ed6ee78f8c02d1e1eb70c181e shipit-source-id: 95ca701354fe728ed6ee78f8c02d1e1eb70c181e
This commit is contained in:
parent
732f2e17ac
commit
b860897cd5
|
@ -32,6 +32,8 @@ public class ARTGroupShadowNode extends ARTVirtualNode {
|
|||
child.draw(canvas, paint, opacity);
|
||||
child.markUpdateSeen();
|
||||
}
|
||||
|
||||
restoreCanvas(canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue