React Native 中的 clipsToBounds

Yan*_*eva 6 react-native

clipsToBounds = trueReact Native的替代品是什么?我有超出父视图范围的子视图。在使用 swift 的 iOS 中,我会用clipsToBounds = true

Vla*_*tko 20

您必须使用style视图的属性并设置overflowhidden. 像这样的东西:

<View style={{ overflow: ‘hidden’ }}>
   {/* These views won’t be presented out of the view */}
</View>
Run Code Online (Sandbox Code Playgroud)

  • 另请注意,如果您设置了“overflow:hidden”,则“overflow:hidden”将隐藏阴影。 (3认同)