React native SVG在react native中被打断

React native SVG在react native中被打断,react-native,svg,react-native-svg,React Native,Svg,React Native Svg,我使用react-native svg和react-native svg transformer在我们的应用程序中呈现svg。所有SVG都能正确渲染,除了这一个SVG在其右侧被切断。这是渲染的SVG(SVG的右侧为截断): 这是我想要呈现的原始svg: 我不知道我做错了什么,但我也尝试过使用viewBoxprop,仍然没有效果。我怎样才能纠正这个问题 代码: 从“../../Assets/Images/WelcomeScreenSVGImages/Your Eldercare Partner

我使用react-native svg和react-native svg transformer在我们的应用程序中呈现svg。所有SVG都能正确渲染,除了这一个SVG在其右侧被切断。这是渲染的SVG(SVG的右侧为截断):

这是我想要呈现的原始svg:

我不知道我做错了什么,但我也尝试过使用
viewBox
prop,仍然没有效果。我怎样才能纠正这个问题

代码:

从“../../Assets/Images/WelcomeScreenSVGImages/Your Eldercare Partner.svg”导入您的Eldercare Repartner;
常数数据=[
...
{
标题:“欢迎来到埃莫哈!”,
svg:{
图片:你的接班人,
宽度:马力(40),
身高:马力(40)
},
信息:“印度最大的老年人虚拟社区。该应用程序为您提供一站式解决方案,满足老年人在舒适的家中健康、充满活力地生活所需的一切需求。”
},
...
];
返回(
setIndex(index)}
showsButtons={false}
showsPagination={true}
renderPagination={handlePagination}
>
{
data.map((基准面,idx)=>)
}
)
常量屏幕=({datum})=>(
{datum.heading}
{datum.message}
)

这可能是viewBox属性。您可以尝试增加viewBox第三个组件的值。另外,svg元素声明的宽度和高度也可能不保留aaspect比率。您可以尝试只设置宽度。您是否使用
元素?在这种情况下,它可能是
元素的视图框。一个终身工作的例子可能有用你认为终身工作的例子是什么意思?我尝试增加viewBox道具中的第三个值,只设置宽度。两者都不起作用。你能给svg添加一个链接吗?pastebin中的代码必须是原始svg,而不是有问题的代码。
import YourEldercarePartner from '../../Assets/Images/WelcomeScreenSVGImages/Your-Eldercare-Partner.svg';

const data = [
        ...
        {
            heading: "Welcome to Emoha!",
            svg: {
                image: YourEldercarePartner,
                width: hp(40),
                height: hp(40)
            },
            message: "India’s largest virtual community of Elders. This app is your one-stop solution for everything Elders need to live a healthy and energized life in the comfort of home."
        },
        ...
];

return (
    <Swiper 
        ref={swiper}
        loop={false}
        onIndexChanged={index => setIndex(index)}
        showsButtons={false}
        showsPagination={true}
        renderPagination={handlePagination}
    >
        {
            data.map((datum, idx) => <Screen datum={datum} key={idx}/> )
        }
    </Swiper>
)

const Screen = ({ datum }) => (
    <View style={styles.container}>
        <View style={styles.main}>
            <Text style={styles.heading}>
                {datum.heading}
            </Text>
            <View style={{ marginTop: 10, flex: 10, justifyContent: 'flex-start' }}>
                <datum.svg.image
                    width={datum.svg.width} 
                    height={datum.svg.height}  
                />
            </View>
            <Text style={styles.message}>
                {datum.message} 
            </Text>
        </View>
    </View>
)