NavigatorIOS转换导致图像闪烁

时间:2015-11-20 13:36:24

标签: javascript reactjs react-native

我使用NavigatorIOS在带有Image标签的页面之间进行转换。在每个"前进"转换所有图像闪烁。如何摆脱它?

在模拟器和设备(iPhone 5)上发生React Native 0.11.0(在以后的版本中未经测试)。

演示:

AnnoyingBlinkingDemo

代码:

var React = require('react-native');

var {
  AppRegistry,
  Image,
  NavigatorIOS,
  Text,
  TouchableOpacity,
  View,
} = React;

var NavigatorRoot = React.createClass({
  render(){
    return (
      <NavigatorIOS
        style={{flex: 1,}}
        ref="navigator"
        initialRoute={{
          component: TestPage,
          title: 'Test Page',
        }}
      />
    )
  },
});

var TestPage = React.createClass({
  render(){
    return (
      <View >
        <Image
          style={{width: 340, height: 300,}}
          source={{uri: "http://dummyimage.com/320/300/090&text=test_image"}}
        />

        <Text >
          This is a page with intentionally unstyled content. Note that before each "forward" transition the image blinks. Other components (like this text) are not affected.
        </Text>

        <TouchableOpacity
          onPress={()=>{
            this.props.navigator.push({
              component: TestPage,
              title: 'Test Page',
            });
          }}
        >
          <View>
            <Text >TEST BUTTON</Text>
          </View>
        </TouchableOpacity>
      </View>
    );
  }
});

AppRegistry.registerComponent('reference', ()=> NavigatorRoot );

1 个答案:

答案 0 :(得分:4)

这是React Native 0.14中修复的错误。升级或挑选this commit