rn-css 1.7.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +13 -2
- package/dist/convertStyle.d.ts +2 -3
- package/dist/convertUnits.js +1 -1
- package/dist/cssToRN/index.d.ts +1 -1
- package/dist/index.d.ts +157 -156
- package/dist/rnToCss.d.ts +3 -0
- package/dist/rnToCss.js +8 -0
- package/dist/styleComponent.d.ts +13 -13
- package/dist/styleComponent.js +9 -1
- package/dist/types.d.ts +4 -2
- package/package.json +1 -1
- package/src/convertStyle.tsx +5 -5
- package/src/convertUnits.ts +1 -1
- package/src/index.tsx +2 -1
- package/src/rnToCss.ts +11 -0
- package/src/styleComponent.tsx +27 -17
- package/src/types.ts +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Version 1.8
|
|
4
|
+
|
|
5
|
+
* Accept returning an RN Style object in the tagged template string
|
|
6
|
+
* Fix a type issue in the style prop of the components
|
|
7
|
+
|
|
8
|
+
## Version 1.7
|
|
9
|
+
|
|
10
|
+
* Improve type support for the Theming system
|
|
11
|
+
|
|
3
12
|
## Version 1.6
|
|
4
13
|
|
|
5
14
|
* Creation of RemContext to control rem units value
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This is basically [styled-components](https://github.com/styled-components/styled-components) with a much better support for React-Native, and some awesome additional features. You can check the docs of [styled-components](https://github.com/styled-components/styled-components) for more details about the basic API. I'll focus here on the differences.
|
|
4
4
|
|
|
5
|
-
**Current version: 1.
|
|
5
|
+
**Current version: 1.8** [See the Changelog](./CHANGELOG.md)
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -91,6 +91,17 @@ const View = styled.View<{ color: string }>`
|
|
|
91
91
|
`
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
+
Here is an example returning directly a Style object:
|
|
95
|
+
|
|
96
|
+
```javascript
|
|
97
|
+
const View = styled.View`
|
|
98
|
+
color: black;
|
|
99
|
+
${props => ({ justifyContent: props.center })}
|
|
100
|
+
`
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
94
105
|
---
|
|
95
106
|
|
|
96
107
|
### <ins>attrs:</ins>
|
|
@@ -323,7 +334,7 @@ const View = styled.View`
|
|
|
323
334
|
|
|
324
335
|
### <ins>Typescript:</ins>
|
|
325
336
|
|
|
326
|
-
For Typescript, `shared` will always be typed with `unknown`. You need to manually declare the type of your shared object.
|
|
337
|
+
For Typescript, `shared` will always be typed with `unknown`. You need to manually declare the type of your shared object. Read the Theming section to learn more about workarounds.
|
|
327
338
|
|
|
328
339
|
```typescript
|
|
329
340
|
// Create your theme
|
package/dist/convertStyle.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { PartialStyle, Units } from './types';
|
|
1
|
+
import type { AnyStyle, PartialStyle, Units } from './types';
|
|
3
2
|
/** Mix the calculated RN style within the object style */
|
|
4
|
-
declare const convertStyle: (rnStyle: PartialStyle, units: Units) =>
|
|
3
|
+
declare const convertStyle: <T extends AnyStyle = AnyStyle>(rnStyle: PartialStyle, units: Units) => T;
|
|
5
4
|
export default convertStyle;
|
package/dist/convertUnits.js
CHANGED
|
@@ -12,7 +12,7 @@ function parseValue(value) {
|
|
|
12
12
|
exports.parseValue = parseValue;
|
|
13
13
|
/** Convert a value using the provided unit transform table */
|
|
14
14
|
function convertValue(key, value, units) {
|
|
15
|
-
if (
|
|
15
|
+
if (typeof value !== 'string') {
|
|
16
16
|
console.error(`Failed to parse CSS instruction: ${key}=${value}. We expect a string, but ${value} was of type ${typeof value}.`);
|
|
17
17
|
return 0;
|
|
18
18
|
}
|
package/dist/cssToRN/index.d.ts
CHANGED