rn-css 1.6.14-1 → 1.6.14-2

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.
@@ -16,8 +16,8 @@ function stripSpaces(string) {
16
16
  }
17
17
  function cssToStyle(css) {
18
18
  const result = {};
19
- // Find media queries
20
- const cssWithoutMediaQueries = css.replace(/@media(.*?){[^{}]*}/gmis, res => {
19
+ // Find media queries (We use [\s\S] instead of . because dotall flag (s) is not supported by react-native-windows)
20
+ const cssWithoutMediaQueries = css.replace(/@media([\s\S]*?){[^{}]*}/gmi, res => {
21
21
  const { css, isValid } = (0, mediaQueries_1.createMedia)(res);
22
22
  const style = cssChunkToStyle(css);
23
23
  const mediaQuery = (context) => isValid(context) && style;
@@ -26,9 +26,9 @@ function cssToStyle(css) {
26
26
  result.media.push(mediaQuery);
27
27
  return '';
28
28
  });
29
- // Find hover (we don't support hover within media queries)
30
- const cssWithoutHover = cssWithoutMediaQueries.replace(/&:hover\s*{(.*?)}/gmis, res => {
31
- const hoverInstructions = res.substring(0, res.length - 1).replace(/&:hover\s*{/mis, ''); // We remove the `&:hover {` and `}`
29
+ // Find hover (we don't support hover within media queries) (We use [\s\S] instead of . because dotall flag (s) is not supported by react-native-windows)
30
+ const cssWithoutHover = cssWithoutMediaQueries.replace(/&:hover\s*{([\s\S]*?)}/gmi, res => {
31
+ const hoverInstructions = res.substring(0, res.length - 1).replace(/&:hover\s*{/mi, ''); // We remove the `&:hover {` and `}`
32
32
  result.hover = cssChunkToStyle(hoverInstructions);
33
33
  return '';
34
34
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rn-css",
3
- "version": "1.6.14-1",
3
+ "version": "1.6.14-2",
4
4
  "scripts": {
5
5
  "test": "jest",
6
6
  "prepare": "tsc",
@@ -14,8 +14,8 @@ function stripSpaces (string: string) {
14
14
 
15
15
  function cssToStyle (css: string) {
16
16
  const result: Style = {}
17
- // Find media queries
18
- const cssWithoutMediaQueries = css.replace(/@media(.*?){[^{}]*}/gmis, res => {
17
+ // Find media queries (We use [\s\S] instead of . because dotall flag (s) is not supported by react-native-windows)
18
+ const cssWithoutMediaQueries = css.replace(/@media([\s\S]*?){[^{}]*}/gmi, res => {
19
19
  const { css, isValid } = createMedia(res)
20
20
  const style = cssChunkToStyle(css)
21
21
  const mediaQuery = (context: Context) => isValid(context) && style
@@ -23,9 +23,9 @@ function cssToStyle (css: string) {
23
23
  result.media!.push(mediaQuery)
24
24
  return ''
25
25
  })
26
- // Find hover (we don't support hover within media queries)
27
- const cssWithoutHover = cssWithoutMediaQueries.replace(/&:hover\s*{(.*?)}/gmis, res => {
28
- const hoverInstructions = res.substring(0, res.length - 1).replace(/&:hover\s*{/mis, '')// We remove the `&:hover {` and `}`
26
+ // Find hover (we don't support hover within media queries) (We use [\s\S] instead of . because dotall flag (s) is not supported by react-native-windows)
27
+ const cssWithoutHover = cssWithoutMediaQueries.replace(/&:hover\s*{([\s\S]*?)}/gmi, res => {
28
+ const hoverInstructions = res.substring(0, res.length - 1).replace(/&:hover\s*{/mi, '')// We remove the `&:hover {` and `}`
29
29
  result.hover = cssChunkToStyle(hoverInstructions)
30
30
  return ''
31
31
  })