4Manuals

  • PDF Cloud HOME

扩大联系-React Native Download

    如何在Android中使用WebRTC缩放相机 反应:更改方向后触发重新渲染和offsetWidth的重新计算 Android 10,API29:在应用程序文件夹中使用C ++库编写文件会使应用程序崩溃 如何将动态值传递给渐变xml 如何在react图表上的datakey中操作DateTime 加载数据并推送到未显示的RecyclerView中 调用Model类的函数时出现java.lang.NullPointerException 从网络加载图像时,“接收到完整的报头之前关闭连接 Ionic 3错误:“缺少文件google-services.json。没有它,Google Services插件将无法运行。”在离子科尔多瓦建立/准备Android androidx.appcompat.view.menu.MenuItemImpl无法转换为android.widget.TextView

新的反应,我目前正在玩列表。我正在研究一个发现的示例,但想对其添加更多操作。我正在尝试扩大接触范围,使其在按一下以显示照片时也能显示更多信息,例如电话号码或电子邮件地址等,类似于在iPhone上的工作方式。我知道您将不得不使用按播功能,但不确定如何设置其余功能,因此,如果没有太大的麻烦,任何建议都是很好的。

谢谢

import React, { Component } from "react";
import {
  StyleSheet,
  Text,
  View,
  TouchableOpacity,
  Image,
  SectionList
} from "react-native";

export default class ContactList extends Component {
  constructor(props) {
    super(props);
    this.state = {
      data: [
        {
          title: "Contacts",
          data: [
            {
              key: 1,
              name: "User 1",
              image:
                "https://bootdey.com/img/Content/avatar/avatar1.png"
            },
            {
              key: 2,
              name: "User 2",
              image: "https://bootdey.com/img/Content/avatar/avatar1.png"
            },
            {
              key: 3,
              name: "User 3",
              image: "https://bootdey.com/img/Content/avatar/avatar7.png"
            },

            {
              key: 4,
              name: "User 1",
              image: "https://bootdey.com/img/Content/avatar/avatar3.png"
            },
            {
              key: 5,
              name: "User 2",
              image: "https://bootdey.com/img/Content/avatar/avatar4.png"
            },

            {
              key: 6,
              name: "User 1",
              image: "https://bootdey.com/img/Content/avatar/avatar5.png"
            },

            {
              key: 7,
              name: "User 1",
              image: "https://bootdey.com/img/Content/avatar/avatar2.png"
            }
          ]
        }
      ]
    };
  }

  render() {
    return (
      <View style={styles.container}>
        <SectionList
          sections={this.state.data}
          renderSectionHeader={({ section }) => {
            return (
              <View style={styles.titleContainer}>
                <Text style={styles.title}>{section.title}</Text>
              </View>
            );
          }}
          renderItem={({ item }) => {
            return (
              <View style={styles.container}>
                <TouchableOpacity onPress={() => {}}>
                  <Image style={styles.image} source={{ uri: item.image }} />
                </TouchableOpacity>
                <View style={styles.content}>
                  <View style={styles.contentHeader}>
                    <Text style={styles.name}>{item.name}</Text>
                  </View>
                </View>
              </View>
            );
          }}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  root: {
    marginTop: 20,
    padding: 10
  },
  titleContainer: {
    shadowColor: "#00000021",
    shadowOffset: {
      width: 2
    },
    shadowOpacity: 0.5,
    shadowRadius: 4,
    marginVertical: 8,
    backgroundColor: "#DCDCDC",
    padding: 10
  },
  title: {
    fontSize: 25,
    color: "#000000"
  },
  container: {
    paddingVertical: 12,
    flexDirection: "row",
    alignItems: "flex-start",
    flexDirection: "row",
    alignItems: "flex-start"
  },
  content: {
    marginLeft: 16,
    flex: 1
  },
  contentHeader: {
    flexDirection: "row",
    justifyContent: "space-between",
    marginBottom: 6
  },
  separator: {
    height: 1,
    backgroundColor: "#CCCCCC"
  },
  image: {
    width: 45,
    height: 45,
    borderRadius: 20,
    marginLeft: 20
  },
  time: {
    fontSize: 11,
    color: "#808080"
  },
  name: {
    fontSize: 16,
    fontWeight: "bold"
  }
});

0 个答案:

没有答案



Similar searches
    PHP检索多维数组值 Knex子查询对第二个表中的数据求和 ECS主机级进程的主机CPU使用率? 用于测试的Spring Security Oauth2 H2-找不到表“ OAUTH_ACCESS_TOKEN” mongodb我如何只能更新一个嵌套文档