1
안녕하세요, 저는 네이티브 반응 네트워크에서 소셜 네트워킹 앱을 개발 중입니다. 나는 이미지에 표시된 방법으로 <Image>
을 절감 할 수 있는지 알고 싶어 :반응 네이티브에서 어떻게 대각선으로 이미지를자를 수 있습니까?
네, 당신은이를 구현하기 위해 나에게 몇 가지 예를 또는 어떤 힌트를 제공 할 수 있습니다.
안녕하세요, 저는 네이티브 반응 네트워크에서 소셜 네트워킹 앱을 개발 중입니다. 나는 이미지에 표시된 방법으로 <Image>
을 절감 할 수 있는지 알고 싶어 :반응 네이티브에서 어떻게 대각선으로 이미지를자를 수 있습니까?
네, 당신은이를 구현하기 위해 나에게 몇 가지 예를 또는 어떤 힌트를 제공 할 수 있습니다.
당신은 흰색 삼각형을 표시 할 수 있습니다 귀하의 이미지 위에 View
모양
import React from 'react';
import { StyleSheet, View, Image, Dimensions } from 'react-native';
export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<Image style={styles.img} source={require('./images.jpg')} >
<View style={[styles.triangle]} /></Image>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
triangle: {
position: 'absolute',
right: 0,
bottom: 0,
width: 0,
height: 0,
backgroundColor: 'transparent',
borderStyle: 'solid',
borderLeftWidth: Dimensions.get('window').width,
borderRightWidth: 0,
borderBottomWidth: 50,
borderLeftColor: 'transparent',
borderRightColor: 'transparent',
borderBottomColor: '#fff',
},
img: {
width: Dimensions.get('window').width,
},
});