
Product
Introducing Custom Pull Request Alert Comment Headers
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
react-native-worry-free-style-sheet
Advanced tools
一个省心的React-Native StyleSheet工具方法
yarn add react-native-worry-free-style-sheet
import StyleSheet, { IgnoreValue } from 'react-native-worry-free-style-sheet';
const styles = StyleSheet.create({
container: {
flex: 1,
},
box1: {
marginTop: 50,
width: 375,
height: new IgnoreValue(30),
backgroundColor: 'red',
borderWidth: 0.6,
borderColor: 'red',
borderRadius: 20,
marginLeft: 10,
},
text: {
fontSize: 15,
},
});
import StyleSheet from 'react-native-worry-free-style-sheet';
StyleSheet.setConfig({
baseWidth: 750,
});
包含默认StyleSheet的方法
方法/常量 | 参数类型 | 描述 |
---|---|---|
scaleSize | number | 屏幕适配, 缩放size , 默认根据宽度适配,纵向也可以使用此方法 |
setConfig | { baseWidth } | 修改配置 |
IgnoreValue | new IgnoreValue(100) | 忽略转换 |
isIphoneX | 判断是否为iphoneX | |
ifIphoneX | iphoneXStyle,iosStyle,androidStyle | 根据是否是iPhoneX返回不同的样式 |
statusBarHeight | 状态栏高度 | |
navigationBarHeight | 常规导航栏高度(包含状态栏) | |
navBarHeight | 状态栏加导航栏的高度 | |
navBarUnlessStatusHeight | 导航栏高度(不包含状态栏) | |
getBottomSpace | 获取底部边距 | |
onePixel | 常量 | 1个像素 |
screenW | 常量 | 屏幕宽度 |
screenH | 常量 | 屏幕高度 |
isIOS | 常量 | 是否 iOS |
isAndroid | 常量 | 是否 Android |
const transformKeys = {
fontSize: true,
width: true,
height: true,
start: true,
end: true,
top: true,
left: true,
right: true,
bottom: true,
minWidth: true,
maxWidth: true,
minHeight: true,
maxHeight: true,
margin: true,
marginVertical: true,
marginHorizontal: true,
marginTop: true,
marginBottom: true,
marginLeft: true,
marginRight: true,
marginStart: true,
marginEnd: true,
padding: true,
paddingVertical: true,
paddingHorizontal: true,
paddingTop: true,
paddingBottom: true,
paddingLeft: true,
paddingRight: true,
paddingStart: true,
paddingEnd: true,
lineHeight: true,
borderRadius: true,
borderWidth: true,
borderTopWidth: true,
borderStartWidth: true,
borderEndWidth: true,
borderRightWidth: true,
borderBottomWidth: true,
borderLeftWidth: true,
borderBottomEndRadius: true,
borderBottomLeftRadius: true,
borderBottomRightRadius: true,
borderBottomStartRadius: true,
borderTopEndRadius: true,
borderTopLeftRadius: true,
borderTopRightRadius: true,
borderTopStartRadius: true,
};
FAQs
省心的React-Native StyleSheet工具方法
We found that react-native-worry-free-style-sheet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.