当前位置 : 主页 > 网络编程 > JavaScript >

我剛剛寫了一個React Native 組件

来源:互联网 收集:自由互联 发布时间:2021-07-03
這是一個ReactNativeCardComponent有興趣可以看看 https://github.com/jacklam718/react-native-card-view 1. [代码] [JavaScript]代码 import React, {Component} from 'react';import { StyleSheet} from 'react-native';import { Card, Car
這是一個React Native Card Component 有興趣可以看看
https://github.com/jacklam718/react-native-card-view

1. [代码][JavaScript]代码    

import React, {Component} from 'react';
import {
  StyleSheet
} from 'react-native';

import {
  Card,
  CardImage,
  CardTitle,
  CardContent,
  CardAction
} from 'react-native-card-view';

Class Example extends Component {
  render () {
    return (
      <Card>
        <CardTitle>
          <Text style={styles.title}>Card Title</Text>
        </CardTitle>
        <CardContent>
          <Text>Content</Text>
        </CardContent>
        <CardAction >
          <Button
            style={styles.button}
            onPress={() => {}}>
            Button 1
          </Button>
          <Button
            style={styles.button}
            onPress={() => {}}>
            Button 2
          </Button>
        </CardAction>
      </Card>
    );
  }
}

const styles = StyleSheet.create({
  title: {
    fontSize: 38,
    backgroundColor: 'transparent'
  },
  button: {
    marginRight: 10
  }
});

2. [图片] react-native-card-view-38.png    

网友评论