0

我无法按预期使用 textShadow 适当性。这是我的代码:

import React from 'react'
import { StyleSheet, View, Text } from 'react-native'

class Test extends React.Component {
  
  render() {
    return (
      <View style={styles.main_container}>
         <Text style={}>Some textooo</Text>
      </View>
    )
  }
}

const styles = StyleSheet.create({
  main_container: {
    flex: 1,
    justifyContent:'center',
    alignItems:'center',
  },
  text: {
    fontSize: 30, 
    fontWeight: '900', 
    textShadowColor: 'rgba(0, 0, 0, 0.8)', 
    textShadowOffset: { width: 0, height: 0 },
    textShadowRadius: 10,
}

 
})

export default Test

这是它的渲染方式:

带阴影的文字

如您所见,阴影在文本的开头和结尾处被剪切......

有谁知道如何避免这种情况?(无需在要渲染的字符串中添加“”)

非常感谢您的帮助。

4

1 回答 1

1

这是您的代码的一个工作示例https://snack.expo.io/@jsfit/text-shadow对我来说似乎不错

在此处输入图像描述

于 2020-06-21T10:42:09.533 回答