Skip to content

Commit 5e5ded5

Browse files
authored
chore: migrate from react-native-dotenv to babel-plugin-dotenv-import
* Update change-guideline-sizes.md * Update import * Rename react-native-dotenv.js to @env.js * Update mock
1 parent f8dea54 commit 5e5ded5

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed
File renamed without changes.

__tests__/scaling-utils.extend.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
jest.mock('react-native');
2-
jest.mock('react-native-dotenv');
2+
jest.mock('@env');
33
import { scale, verticalScale, moderateScale, moderateVerticalScale } from '../extend';
44

55
describe('scaling-utils when guideline sizes are set using react-native-dotenv', () => {
@@ -32,4 +32,4 @@ describe('scaling-utils when guideline sizes are set using react-native-dotenv',
3232
expect(Math.floor(moderateVerticalScale(100, 0.9))).toBe(100);
3333
expect(Math.floor(moderateVerticalScale(100, 2))).toBe(100);
3434
});
35-
});
35+
});

examples/change-guideline-sizes.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
In the ever-changing mobile devices world, screen sizes change a lot.
44
This lib uses 350dp x 680dp as guideline sizes, but if you (or your designer) prefer using different sizes it's possible.
55

6-
To do so, first, you'd need to setup [react-native-dotenv](https://github.com/zetachang/react-native-dotenv).
6+
To do so, first, you'd need to setup [babel-plugin-dotenv-import](https://github.com/tusbar/babel-plugin-dotenv-import).
77
After setting it up and creating `.env` file, add the following env params to it:
88
```env
99
SIZE_MATTERS_BASE_WIDTH=<custom-width>
@@ -12,4 +12,4 @@ SIZE_MATTERS_BASE_HEIGHT=<custom-height>
1212
Next and final step, you should change all your imports to `react-native-size-matters/extend`, for instance:
1313
```javascript
1414
import { ScaledSheet, moderateScale } from 'react-native-size-matters/extend';
15-
```
15+
```

lib/extend/scaling-utils.extend.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Dimensions } from 'react-native';
2-
import { SIZE_MATTERS_BASE_WIDTH, SIZE_MATTERS_BASE_HEIGHT } from 'react-native-dotenv';
2+
import { SIZE_MATTERS_BASE_WIDTH, SIZE_MATTERS_BASE_HEIGHT } from '@env';
33

44
const { width, height } = Dimensions.get('window');
55
const [shortDimension, longDimension] = width < height ? [width, height] : [height, width];
@@ -16,4 +16,4 @@ export const moderateVerticalScale = (size, factor = 0.5) => size + (verticalSca
1616
export const s = scale;
1717
export const vs = verticalScale;
1818
export const ms = moderateScale;
19-
export const mvs = moderateVerticalScale;
19+
export const mvs = moderateVerticalScale;

0 commit comments

Comments
 (0)