styled-components/css-to-react-native là dự án mã nguồn mở trên GitHub với 1.2k sao, viết chủ yếu bằng TypeScript. Convert CSS text to a React Native stylesheet object
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Shorthands will only accept values that are supported in React Native, so background will only accept a colour, backgroundColor will not accept an image, and font will not accept font-variant values that React Native does not support.
React Native's box-shadow and filter properties are passed through as
boxShadow and filter, so support depends on your React Native version.
Shorthand Notes
border{Top,Right,Bottom,Left} shorthands are not supported, because borderStyle cannot be applied to individual border sides.
Supported Properties
Most React Native style properties work without a custom mapping table. Write the
React Native property name in kebab-case and this library will convert it back to
the camel-cased React Native key for you.
CSS input
React Native output
align-content
alignContent
background-color
backgroundColor
border-top-left-radius
borderTopLeftRadius
font-size
fontSize
justify-content
justifyContent
text-decoration-color
textDecorationColor
text-shadow-radius
textShadowRadius
That rule covers the standard one-to-one mappings. The library also supports the
following shorthand and special-case transforms:
If you are unsure whether a property is available in React Native itself, check
the React Native style docs and convert the property name to kebab-case when you
write it in CSS.
API
The API is mostly for implementors. However, the main API may be useful for non-implementors. The main API is an array of [property, value] tuples.
We don't provide a way to get these style tuples in this library, so you'll need to do that yourself. I expect most people will use postCSS or another CSS parser. You should try avoid getting these with string.split, as that has a lot of edge cases (colons and semi-colons appearing in comments etc.)
For implementors, there is also a few extra APIs available.
These are for specific use-cases, and most people should just be using the API above.
Should you wish to opt-out of transforming certain shorthands, an array of property names in camelCase can be passed as a second argument to transform.
transform([['border-radius', '50px']], ['borderRadius']);
// { borderRadius: 50 } rather than { borderTopLeft: ... }
This can also be done by passing a third argument, false to getStylesForProperty.
transformRawValue is a lower-level helper that parses a single raw value without applying shorthand expansion.
Đọc thêm về styled-components/css-to-react-native ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/styled-components/css-to-react-native là nguồn chính thức.
styled-components/css-to-react-native có bao nhiêu sao?
styled-components/css-to-react-native có 1.2k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/styled-components/css-to-react-native. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
styled-components/css-to-react-native có phải mã nguồn mở không?
Có — styled-components/css-to-react-native phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/styled-components/css-to-react-native.
styled-components/css-to-react-native có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho styled-components/css-to-react-native. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
styled-components/css-to-react-native là gì?
styled-components/css-to-react-native (styled-components/css-to-react-native) là dự án TypeScript trên GitHub. Theo mô tả gốc: Convert CSS text to a React Native stylesheet object
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về css-to-react-native?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về css-to-react-native.