關(guān)鍵邏輯,父視圖設(shè)置? ? overflow:'hidden' 屬性進行處理
import React, { Component } from 'react';
import {
? AppRegistry,
? Image,
? View,
? StyleSheet
} from 'react-native';
class ImageBorder extends Component
{
? ? render(
? ? ? View style={styles.container}
? ? ? ? ? ? ?Image style ={styles.imageStyle}? source={require('./img/xxxxxxx.png')}
? ? ?View
? ? )
? ? {
? ? return (
? ? )
? ? };
};
const styles = StyleSheet.create({
? ? container: {
? ? backgroundColor:'red',
? ? borderTopLeftRadius:20,
? ? overflow:'hidden',
? ? height: 200,
? ? marginLeft:100,
? ? width: 200,
? ? borderTopRightRadius:20
? ? ,
? ? },
? ? imageStyle: {
? ? ? padding: 10,
? ? ? fontSize: 18,
? ? ? height: 200,
? ? ? width: 200
? ? }
? })
? module.exports = ImageBorder