探索React Native用户资料组件:react-native-user-profile
warning:
这篇文章距离上次修改已过202天,其中的内容可能已经有所变动。
import React from 'react';
import { View, Text, Image } from 'react-native';
import UserProfile from 'react-native-user-profile';
const UserInfo = () => {
return (
<UserProfile
name="John Doe"
title="Software Developer"
about="Loves pets, hiking, and coding."
avatar="https://randomuser.me/api/portraits/men/1.jpg"
social={[
{ icon: 'email', value: 'johndoe@example.com', onPress: () => alert('Email') },
{ icon: 'phone', value: '+1-202-555-0170', onPress: () => alert('Call') },
{ icon: 'linkedin', value: 'linkedin.com/in/johndoe', onPress: () => alert('LinkedIn') }
]}
style={{ backgroundColor: '#f9f9f9' }}
/>
);
};
export default UserInfo;
这个代码实例展示了如何使用react-native-user-profile
组件来创建一个简单的用户资料界面。它包括用户的头像、姓名、职位、简介以及电子邮件、电话和LinkedIn的方式。点击相应的图标会弹出提示框显示相应的联系方式。背景颜色被设置为#f9f9f9
,这是一个简洁而专业的用户资料界面。
评论已关闭