ptmt / react-native-macos

[deprecated in favor of https://microsoft.github.io/react-native-windows/] React Native for macOS is an experimental fork for writing desktop apps using Cocoa
MIT License
11.24k stars 429 forks source link

Broken background color updates #114

Closed theneverstill closed 8 years ago

theneverstill commented 8 years ago

Commit 52f89c727ae60641beafad0fb5ec8bad7106248b broke background color on render updates.

Steps to repeat:

Create a view: <View style={{backgroundColor: this.state.backgroundColor}}/>

The view will render correctly on first render, but all subsequent renders triggered by changing this.state.backgroundColor will fail.

Instead of changing the view's background color, it appears to be changing the background color of a mysterious view 'behind' the view. This can be observed by adding a border radius to the view.

this.styles = StyleSheet.create({ container: { borderRadius: (this.props.size / 2), borderWidth: 1, height: this.props.size, width: this.props.size } });

<View style={[this.styles.container, {backgroundColor: this.state.backgroundColor}]}/>

On updates to the borderRadius example, you'll see that the area outside of the border radius gets updated.

ptmt commented 8 years ago

Thanks for pointing out on the issue. It's definitely should be added to UIExplorer to test that use case before release. Will fix tomorrow.

ptmt commented 8 years ago

Added example to UIExplorer -> View.

Temporary, fix that bug by almost reverting this code.