【问题标题】:NavigatorIOS transition causes Image to blinkNavigatorIOS 转换导致图像闪烁
【发布时间】:2015-11-20 13:36:23
【问题描述】:

我正在使用 NavigatorIOS 在带有图像标签的页面之间进行转换。在每次“向前”转换之前,所有图像都会闪烁。如何摆脱它?

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

演示:

代码:

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 );

【问题讨论】:

    标签: javascript reactjs react-native


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2014-06-18
      • 1970-01-01
      • 2015-05-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-30
      相关资源
      最近更新 更多