老师,这里app闪退了是啥原因呀
来源:13-4 页面之外的播放按钮

爱学习啦啦啦啦
2021-09-04
我设置了 页面之外播放按钮的样式,然后在点击跳转到 播放列表页 的时候, app 闪退了,如果我把那个样式注释了,就没问题,不会闪退
PlayView 的代码:
import React from "react"
import { View, StyleSheet, Platform } from "react-native"
import { viewportWidth } from '@/utils/index';
import Play from './Play'
interface IProps {
}
const PlayView: React.FC<IProps> = () => {
return (
<View
style={styles.container} // 这里如果注释掉了,就不会闪退了
>
<Play />
</View>
)
}
const width = 50;
const styles = StyleSheet.create({
container: {
position: 'absolute',
width: width,
height: width + 20,
bottom: 0,
left: (viewportWidth - width) / 2,
backgroundColor: 'rgba(255, 255, 255, 0.8)',
padding: 4,
borderTopLeftRadius: 25,
borderTopRightRadius: 25,
...Platform.select({
android: {
elevation: 4,
},
ios: {
shadowColor: 'rgba(0, 0, 0, 0.3)',
shadowOpacity: 0.85,
shadowRadius: 5,
shadowOffset: {
width: StyleSheet.hairlineWidth,
height: StyleSheet.hairlineWidth,
},
},
}),
},
});
export default PlayView
是 Platform.select 的问题吗?
写回答
1回答
-
今朝
2021-09-06
不好意思,我在本地使用你的样式进行测试,并没有遇到闪退的问题,你可以试试排除法,看看究竟是哪一个样式导致的
00
相似问题