Skip to content

Commit

Permalink
refactor: upgrade all packages to expo sdk 37 (#185)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: this also bumps all peer dependencies to the bundled native modules for SDK 37.

* refactor(battery): upgrade to expo sdk 37

* refactor(brightness): upgrade to expo sdk 37

* refactor(font): upgrade to expo sdk 37

* refactor(permissions): upgrade to expo sdk 37

* refactor(sensors): upgrade to expo sdk 37

* refactor: upgrade monorepo to expo sdk 37

* fix: use compatible semver range for react types

* refactor(screen-orientation): update screen orientation hooks to new unimodule (#186)

* refactor(screen-orientation): update screen orientation hooks to new unimodule

* refactor(example): update screen orientation hooks

* fix: use sdk 37 compatible peer dependency ranges

* docs: update readme with platform lock

* docs: use expo install for better sdk specific support

* fix(web-browser): use void in effect return property

* fix(web-browser): use compatible semvers in package

* fix(example): translate orientation to readable name
  • Loading branch information
byCedric authored Apr 5, 2020
1 parent e8c0f45 commit 083eca2
Show file tree
Hide file tree
Showing 51 changed files with 811 additions and 588 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add use-expo</pre>
<pre>expo install use-expo</pre>
</div>

### [Battery](./packages/battery)
Expand Down Expand Up @@ -47,6 +47,7 @@

- [`useScreenOrientation`](./packages/screen-orientation/docs/use-screen-orientation.md) &nbsp;&mdash;&nbsp; track changes in screen orientation
- [`useScreenOrientationLock`](./packages/screen-orientation/docs/use-screen-orientation-lock.md) &nbsp;&mdash;&nbsp; lock the screen to an orientation
- [`useScreenOrientationPlatformLock`](./packages/screen-orientation/docs/use-screen-orientation-platform-lock.md) &nbsp;&mdash;&nbsp; lock multiple platforms to an orientation

### [Sensors](./packages/sensors)

Expand Down
1 change: 0 additions & 1 deletion example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"version": "0.0.0",
"slug": "use-expo",
"privacy": "public",
"sdkVersion": "36.0.0",
"githubUrl": "https://github.com/bycedric/use-expo",
"platforms": [
"ios",
Expand Down
39 changes: 20 additions & 19 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,35 @@
"web": "expo start --web"
},
"dependencies": {
"expo": "^36.0.2",
"expo-battery": "~2.0.0",
"expo-brightness": "~8.0.0",
"expo": "^37.0.0",
"expo-battery": "~2.1.0",
"expo-brightness": "~8.1.0",
"expo-camera": "~8.2.0",
"expo-constants": "~8.0.0",
"expo-font": "~8.0.0",
"expo-keep-awake": "~8.0.0",
"expo-permissions": "~8.0.0",
"expo-sensors": "~8.0.0",
"expo-constants": "~9.0.0",
"expo-font": "~8.1.0",
"expo-keep-awake": "~8.1.0",
"expo-permissions": "~8.1.0",
"expo-screen-orientation": "~1.0.0",
"expo-sensors": "~8.1.0",
"expo-yarn-workspaces": "^1.2.1",
"lodash": "^4.17.15",
"react": "~16.9.0",
"react-dom": "~16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",
"react-native-gesture-handler": "~1.5.0",
"react": "16.9.0",
"react-dom": "16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.0.tar.gz",
"react-native-gesture-handler": "~1.6.0",
"react-native-paper": "^2.16.0",
"react-native-reanimated": "~1.4.0",
"react-native-screens": "2.0.0-alpha.12",
"react-native-web": "^0.12.1",
"react-native-reanimated": "~1.7.0",
"react-native-screens": "~2.2.0",
"react-native-web": "^0.11.7",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^1.10.3"
},
"devDependencies": {
"@expo/webpack-config": "^0.11.1",
"@types/lodash": "^4.14.149",
"@types/react": "^16.9.0",
"@types/react-native": "^0.61.2",
"babel-preset-expo": "^8.0.0",
"typescript": "^3.7.2"
"@types/react": "^16.9.11",
"@types/react-native": "^0.60.22",
"babel-preset-expo": "^8.1.0",
"typescript": "^3.8.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { Button } from 'react-native-paper';
import { ScreenOrientation } from 'expo';
import * as ScreenOrientation from 'expo-screen-orientation';
import { useScreenOrientationLock } from 'use-expo';
import { Example, Information, Link, Page, Space } from '../../atoms';
import { MoleculeProps } from '../../providers/molecule';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import { Caption, Text } from 'react-native-paper';
import { useScreenOrientation } from 'use-expo';
import { Orientation, SizeClassIOS } from 'expo-screen-orientation';
import { Example, Information, Link, Measurement, Page } from '../../atoms';
import { MoleculeProps } from '../../providers/molecule';
import { docs } from '../../providers/urls';

export const UseScreenOrientation: React.SFC<MoleculeProps> = (props) => {
const [orientation, sizeClass] = useScreenOrientation();
const [orientation] = useScreenOrientation();

return (
<Page
Expand All @@ -19,14 +20,17 @@ export const UseScreenOrientation: React.SFC<MoleculeProps> = (props) => {
</Information>
<Example>
<Caption>screen orientation</Caption>
<Text>{orientation}</Text>
{!sizeClass
{orientation?.orientation
? <Text>{orientationNames[orientation.orientation]}</Text>
: <Text>unknown</Text>
}
{(!orientation?.verticalSizeClass || !orientation?.horizontalSizeClass)
? <Caption>size class unavailable on this device</Caption>
: (
<>
<Caption>size class</Caption>
<Measurement name='horizontal' value={sizeClass.horizontal} precision={0} />
<Measurement name='vertical' value={sizeClass.vertical} precision={0} />
<Measurement name='horizontal' value={sizeClassNames[orientation.horizontalSizeClass]} />
<Measurement name='vertical' value={sizeClassNames[orientation.verticalSizeClass]} />
</>
)}
</Example>
Expand All @@ -38,3 +42,17 @@ UseScreenOrientation.defaultProps = {
name: 'useScreenOrientation',
description: 'tracks changes in screen orientation',
};

const orientationNames = {
[Orientation.UNKNOWN]: 'unknown',
[Orientation.PORTRAIT_UP]: 'portrait-up',
[Orientation.PORTRAIT_DOWN]: 'portrait-down',
[Orientation.LANDSCAPE_LEFT]: 'landscape-left',
[Orientation.LANDSCAPE_RIGHT]: 'landscape-right',
};

const sizeClassNames = {
[SizeClassIOS.REGULAR]: 'regular',
[SizeClassIOS.COMPACT]: 'compact',
[SizeClassIOS.UNKNOWN]: 'unknown',
};
35 changes: 18 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,39 @@
"url": "https://github.com/bycedric/use-expo.git"
},
"scripts": {
"lint": "tsc --noEmit && eslint . --ext ts,tsx,js,jsx",
"lint": "tsc --noEmit --composite false && eslint . --ext ts,tsx,js,jsx",
"test": "jest",
"build": "lerna run build",
"publish": "lerna publish",
"example": "yarn --cwd example"
},
"devDependencies": {
"@commitlint/cli": "^8.3.4",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@testing-library/react-hooks": "^3.2.1",
"@types/jest": "^25.1.4",
"@types/react": "^16.9.17",
"@typescript-eslint/eslint-plugin": "^2.15.0",
"@typescript-eslint/parser": "^2.15.0",
"@types/jest": "^25.2.1",
"@types/react": "^16.9.32",
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.26.0",
"eslint": "^6.8.0",
"eslint-plugin-jest": "^23.6.0",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-react-hooks": "^2.3.0",
"jest": "^25.1.0",
"jest-expo": "^36.0.1",
"eslint-plugin-jest": "^23.8.2",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^3.0.0",
"jest": "^25.2.7",
"jest-expo": "^37.0.0",
"lerna": "^3.20.2",
"react": "^16.9.0",
"typescript": "^3.7.4"
"react": "16.9.0",
"typescript": "^3.8.3"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"resolutions": {
"expo": "^36.0.2",
"react": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",
"react-test-renderer": "~16.9.0"
"expo": "37.0.0",
"react": "16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.0.tar.gz",
"react-test-renderer": "16.9.0",
"typescript": "^3.8.3"
},
"workspaces": {
"packages": [
Expand Down
2 changes: 1 addition & 1 deletion packages/battery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add @use-expo/battery expo-battery</pre>
<pre>expo install @use-expo/battery expo-battery</pre>
<br />
</div>

Expand Down
2 changes: 1 addition & 1 deletion packages/battery/docs/use-battery-level.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add @use-expo/battery expo-battery</pre>
<pre>expo install @use-expo/battery expo-battery</pre>
<br />
</div>

Expand Down
2 changes: 1 addition & 1 deletion packages/battery/docs/use-battery-low-power-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add @use-expo/battery expo-battery</pre>
<pre>expo install @use-expo/battery expo-battery</pre>
<br />
</div>

Expand Down
2 changes: 1 addition & 1 deletion packages/battery/docs/use-battery-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add @use-expo/battery expo-battery</pre>
<pre>expo install @use-expo/battery expo-battery</pre>
<br />
</div>

Expand Down
2 changes: 1 addition & 1 deletion packages/battery/docs/use-battery.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add @use-expo/battery expo-battery</pre>
<pre>expo install @use-expo/battery expo-battery</pre>
<br />
</div>

Expand Down
9 changes: 5 additions & 4 deletions packages/battery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@
"devDependencies": {
"@react-native-community/bob": "^0.10.0",
"@testing-library/react-hooks": "^3.2.1",
"@types/react": "^16.9.17",
"expo-battery": "^2.0.0",
"react": "~16.9.0"
"@types/react": "~16.9.32",
"expo-battery": "~2.1.0",
"react": "16.9.0",
"typescript": "^3.8.3"
},
"peerDependencies": {
"expo-battery": ">=1.0.0"
"expo-battery": ">=2.1.0"
},
"@react-native-community/bob": {
"source": "src",
Expand Down
2 changes: 1 addition & 1 deletion packages/brightness/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add @use-expo/brightness expo-brightness</pre>
<pre>expo install @use-expo/brightness expo-brightness</pre>
<br />
</div>

Expand Down
2 changes: 1 addition & 1 deletion packages/brightness/docs/use-brightness.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add @use-expo/brightness expo-brightness</pre>
<pre>expo install @use-expo/brightness expo-brightness</pre>
<br />
</div>

Expand Down
2 changes: 1 addition & 1 deletion packages/brightness/docs/use-system-brightness-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add @use-expo/brightness expo-brightness</pre>
<pre>expo install @use-expo/brightness expo-brightness</pre>
<br />
</div>

Expand Down
2 changes: 1 addition & 1 deletion packages/brightness/docs/use-system-brightness.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add @use-expo/brightness expo-brightness</pre>
<pre>expo install @use-expo/brightness expo-brightness</pre>
<br />
</div>

Expand Down
9 changes: 5 additions & 4 deletions packages/brightness/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@
"devDependencies": {
"@react-native-community/bob": "^0.10.0",
"@testing-library/react-hooks": "^3.2.1",
"@types/react": "^16.9.17",
"expo-brightness": "^8.0.0",
"react": "~16.9.0"
"@types/react": "~16.9.32",
"expo-brightness": "~8.1.0",
"react": "16.9.0",
"typescript": "^3.8.3"
},
"peerDependencies": {
"expo-brightness": ">=5.0.1"
"expo-brightness": ">=8.1.0"
},
"@react-native-community/bob": {
"source": "src",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add @use-expo/font expo-font</pre>
<pre>expo install @use-expo/font expo-font</pre>
<br />
</div>

Expand Down
2 changes: 1 addition & 1 deletion packages/font/docs/use-fonts.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add @use-expo/font expo-font</pre>
<pre>expo install @use-expo/font expo-font</pre>
<br />
</div>

Expand Down
11 changes: 5 additions & 6 deletions packages/font/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@
"devDependencies": {
"@react-native-community/bob": "^0.10.0",
"@testing-library/react-hooks": "^3.2.1",
"@types/react": "^16.9.17",
"expo-asset": "^8.0.0",
"expo-font": "^8.0.0",
"react": "~16.9.0"
"@types/react": "~16.9.32",
"expo-font": "~8.1.0",
"react": "16.9.0",
"typescript": "^3.8.3"
},
"peerDependencies": {
"expo-asset": ">=5.0.1",
"expo-font": ">=5.0.1"
"expo-font": ">=8.1.0"
},
"@react-native-community/bob": {
"source": "src",
Expand Down
2 changes: 1 addition & 1 deletion packages/permissions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add @use-expo/permissions expo-permissions</pre>
<pre>expo install @use-expo/permissions expo-permissions</pre>
<br />
</div>

Expand Down
2 changes: 1 addition & 1 deletion packages/permissions/docs/use-permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add @use-expo/permissions expo-permissions</pre>
<pre>expo install @use-expo/permissions expo-permissions</pre>
<br />
</div>

Expand Down
9 changes: 5 additions & 4 deletions packages/permissions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@
"devDependencies": {
"@react-native-community/bob": "^0.10.0",
"@testing-library/react-hooks": "^3.2.1",
"@types/react": "^16.9.17",
"expo-permissions": "^8.0.0",
"react": "~16.9.0"
"@types/react": "~16.9.32",
"expo-permissions": "~8.1.0",
"react": "16.9.0",
"typescript": "^3.8.3"
},
"peerDependencies": {
"expo-permissions": ">=5.0.1"
"expo-permissions": ">=8.1.0"
},
"@react-native-community/bob": {
"source": "src",
Expand Down
2 changes: 1 addition & 1 deletion packages/screen-orientation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a href="https://github.com/byCedric/use-expo/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
<pre>yarn add @use-expo/screen-orientation</pre>
<pre>expo install @use-expo/screen-orientation</pre>
<br />
</div>

Expand Down
Loading

0 comments on commit 083eca2

Please sign in to comment.