react-native - 设计功能 React Native
问题描述
我希望用户个人资料图片在模态上一半,在模态外一半
我试过这个
height: PROFILE_DIAMETER,
width: PROFILE_DIAMETER,
borderRadius: PROFILE_DIAMETER / 2,
marginLeft: 20,
top: -20,
flex: 0,
resizeMode: 'cover',
overflow: 'hidden',
transform: [{translateY: translateImageY()}, {scale: imgScale()}, {translateX: translateImageX()}]
}}
解决方案
<Image style={{width: '100%', zIndex: -1}} source={require('../assets/capa.png')} />
<View style={{
width: '90%',
backgroundColor: 'white',
alignSelf: 'center',
borderRadius: 10,
paddingBottom: 20
}}>
<View style={{
marginTop: -100
}}>
<Avatar
rounded
size='xlarge'
containerStyle={{ alignSelf: "center", marginTop: 20 }}
overlayContainerStyle={{
borderWidth: 1,
borderColor: '#00a9cf',
backgroundColor: 'white'
}}
source={{
uri:
'https://s3.amazonaws.com/uifaces/faces/twitter/adhamdannaway/128.jpg',
}}
/>
<Text style={{ color: '#383941', fontSize: 22, alignSelf: "center", fontFamily: 'PTSans-Bold' }}>{this.state.name}</Text>
<Text style={{ color: '#79787b', fontSize: 15, alignSelf: "center", fontFamily: 'PTSans-Italic' }}>{this.state.profession}</Text>
</View>
</View>
观察 zindex -1 的图像和包含负 marginTop 的头像的视图
推荐阅读
- javascript - 使用javascript的所有网页中的静态导航栏
- r - 具有因子的数据帧的复杂计数
- excel - 将 INDIRECT 插入另一个公式以替换固定值
- python - 如何根据预定义列表排列集合的输出
- python - Django 创建新用户失败
- linux - 为什么这种使用 sys_write 的尝试没有做任何事情?
- jquery - 我的 Jquery 点击功能针对具有相同类名的所有元素
- c - 从 R 到 C 处理列表并访问它
- azure - 如何在 API-Management 的开发者门户中对 API 调用进行分组
- json - 具有子节点元素列表的杰克逊 json 反序列化器