ImageBackground: use cached styles

Summary:
Replace object with cached styles from StyleSheet

Create new style object may cause performance problems

Check that ImageBackground position works the same way.
Closes https://github.com/facebook/react-native/pull/14486

Differential Revision: D5274503

Pulled By: shergin

fbshipit-source-id: 09b81e6f7ae2ada7f68854e409909caafd85e56a
This commit is contained in:
Aleksei Androsov 2017-06-19 08:36:10 -07:00 committed by Facebook Github Bot
parent 86328e9266
commit 8377b30b8d
1 changed files with 2 additions and 5 deletions

View File

@ -14,6 +14,7 @@
const Image = require('Image');
const React = require('React');
const StyleSheet = require('StyleSheet');
const View = require('View');
/**
@ -49,12 +50,8 @@ class ImageBackground extends React.Component {
<Image
{...props}
style={[
StyleSheet.absoluteFill,
{
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0,
// Temporary Workaround:
// Current (imperfect yet) implementation of <Image> overwrites width and height styles
// (which is not quite correct), and these styles conflict with explicitly set styles