美文网首页
React-Native 控件ViewPagerAndroid

React-Native 控件ViewPagerAndroid

作者: 小张呵呵 | 来源:发表于2016-06-11 10:20 被阅读220次

    /**

    import React, { Component } from 'react';
    import {
    AppRegistry,
    StyleSheet,
    PixelRatio,
    Text,
    Image,
    ViewPagerAndroid,
    TouchableHighlight,
    DrawerLayoutAndroid,
    ProgressBarAndroid,
    View

    } from 'react-native';

    class MyFirstProject extends Component {

    show(txt) {
    alert(txt);
    }
    render() {

    return (
    
      <ViewPagerAndroid
        initialPage={0}
        style = {styles.flex}
        >
        <View style ={styles.flex}>
    
          <Image style={styles.img}
            source={{ uri: 'http://facebook.github.io/react/img/logo_og.png' }}
            />
          <TouchableHighlight
            onPress={this.show.bind(this, '第一个页面') }
            underlayColor='#333'>
            <Text style={styles.touchtext}>haha</Text>
          </TouchableHighlight>
        </View>
        <View style={styles.center}>
          <TouchableHighlight
            onPress={this.show.bind(this, '第二个页面') }
            underlayColor='#333'>
            <Text  style={[{ fontSize: 39 }]}>第二个页面</Text>
          </TouchableHighlight>
        </View>
        <View style={styles.center}>
          <Text  style={[{ fontSize: 39 }]}>第三个页面</Text>
        </View>
      </ViewPagerAndroid >
    
    );
    

    }
    }

    const styles = StyleSheet.create({

    flex: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    },
    img: {
    height: 300,
    width: 300,
    borderRadius: 150,
    borderColor: '#ccc',
    },
    touchtext: {
    fontSize: 39,
    width: 300,

    },

    center: {
    alignItems: 'center',
    justifyContent: 'center',
    }

    });

    AppRegistry.registerComponent('MyFirstProject', () => MyFirstProject);

    相关文章

      网友评论

          本文标题:React-Native 控件ViewPagerAndroid

          本文链接:https://www.haomeiwen.com/subject/tgosdttx.html