【发布时间】:2023-02-15 16:43:27
【问题描述】:
我有一个错误的共享样式:
export const modalStyle(height)= { // <-- Whats the syntax for adding parameter here?
width:MODAL_WIDTH,
height:height,
backgroundColor:color_theme_light.mainGreen,
borderRadius:22,
justifyContent:"center",
alignItems:"center",
shadowColor: "#000",
shadowOffset: {
width: 0,
height: 1,
},
shadowOpacity: 0.20,
shadowRadius: 1.41,
elevation: 2
}
我怎样才能给它添加一个参数,所以当我调用这个样式时我可以动态地改变高度?
import {modalStyle} from './modalStyles'
<View style={modalStyle(40)}>
...
</View>
【问题讨论】:
标签: javascript reactjs react-native styles