Skip to content

Commit

Permalink
[store-review] fix undef error in bare (#6713)
Browse files Browse the repository at this point in the history
  • Loading branch information
cruzach authored and brentvatne committed Jan 8, 2020
1 parent aefcafe commit 11a48ca
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
6 changes: 4 additions & 2 deletions docs/pages/versions/unversioned/sdk/storereview.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ StoreReview.isAvailableAsync();

This uses the `Constants` API to get the `Constants.manifest.ios.appStoreUrl` on iOS, or the `Constants.manifest.android.playStoreUrl` on Android.

In the bare workflow, this will return `null`.

#### Example

```js
Expand All @@ -56,12 +58,12 @@ const url = StoreReview.storeUrl();

### `StoreReview.hasAction()`

This returns a boolean that let's you know if the module can perform any action. This is used for cases where the `app.json` doesn't have the proper fields, and `StoreReview.isAvailableAsync()` returns false.
This returns a promise that resolves to a boolean that let's you know if the module can perform any action. This is used for cases where the `app.json` doesn't have the proper fields, and `StoreReview.isAvailableAsync()` returns false.

#### Example

```js
if (StoreReview.hasAction()) {
if (await StoreReview.hasAction()) {
}
```

Expand Down
6 changes: 4 additions & 2 deletions docs/pages/versions/v36.0.0/sdk/storereview.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ StoreReview.isAvailableAsync();

This uses the `Constants` API to get the `Constants.manifest.ios.appStoreUrl` on iOS, or the `Constants.manifest.android.playStoreUrl` on Android.

In the bare workflow, this will return `null`.

#### Example

```js
Expand All @@ -56,12 +58,12 @@ const url = StoreReview.storeUrl();

### `StoreReview.hasAction()`

This returns a boolean that let's you know if the module can perform any action. This is used for cases where the `app.json` doesn't have the proper fields, and `StoreReview.isAvailableAsync()` returns false.
This returns a promise that resolves to a boolean that let's you know if the module can perform any action. This is used for cases where the `app.json` doesn't have the proper fields, and `StoreReview.isAvailableAsync()` returns false.

#### Example

```js
if (StoreReview.hasAction()) {
if (await StoreReview.hasAction()) {
}
```

Expand Down
6 changes: 4 additions & 2 deletions packages/expo-store-review/build/StoreReview.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/expo-store-review/build/StoreReview.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions packages/expo-store-review/src/StoreReview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ export async function requestReview(): Promise<void> {
*/
export function storeUrl(): string | null {
const { manifest } = Constants;
if (Platform.OS === 'ios' && manifest.ios) {
// eslint-disable-next-line no-undef
if (Platform.OS === 'ios' && manifest?.ios) {
return manifest.ios.appStoreUrl;
} else if (Platform.OS === 'android' && manifest.android) {
// eslint-disable-next-line no-undef
} else if (Platform.OS === 'android' && manifest?.android) {
return manifest.android.playStoreUrl;
} else {
return null;
Expand Down

0 comments on commit 11a48ca

Please sign in to comment.