forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make most modules in Image flow strict-local (facebook#40728)
Summary: Pull Request resolved: facebook#40728 Just improving type safety of a bunch of modules in the `Image` directory. Changelog: [internal] Differential Revision: D50080136 fbshipit-source-id: 320ed32df9653f6f59a36d5bf0fd1311847fe2fe
- Loading branch information
1 parent
267ce4b
commit 9bc01ca
Showing
5 changed files
with
32 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
* @flow strict-local | ||
* @format | ||
*/ | ||
|
||
|
@@ -68,7 +68,7 @@ class AssetSourceResolver { | |
} | ||
|
||
isLoadedFromFileSystem(): boolean { | ||
return !!(this.jsbundleUrl && this.jsbundleUrl.startsWith('file://')); | ||
return this.jsbundleUrl != null && this.jsbundleUrl?.startsWith('file://'); | ||
} | ||
|
||
defaultAsset(): ResolvedAssetSource { | ||
|
@@ -90,7 +90,7 @@ class AssetSourceResolver { | |
* from the devserver | ||
*/ | ||
assetServerURL(): ResolvedAssetSource { | ||
invariant(!!this.serverUrl, 'need server to load from'); | ||
invariant(this.serverUrl != null, 'need server to load from'); | ||
return this.fromSource( | ||
this.serverUrl + | ||
getScaledAssetPath(this.asset) + | ||
|
@@ -114,7 +114,7 @@ class AssetSourceResolver { | |
* E.g. 'file:///sdcard/bundle/assets/AwesomeModule/[email protected]' | ||
*/ | ||
scaledAssetURLNearBundle(): ResolvedAssetSource { | ||
const path = this.jsbundleUrl || 'file://'; | ||
const path = this.jsbundleUrl ?? 'file://'; | ||
return this.fromSource( | ||
// Assets can have relative paths outside of the project root. | ||
// When bundling them we replace `../` with `_` to make sure they | ||
|
@@ -143,7 +143,7 @@ class AssetSourceResolver { | |
* E.g. 'file:///sdcard/AwesomeModule/drawable-mdpi/icon.png' | ||
*/ | ||
drawableFolderInBundle(): ResolvedAssetSource { | ||
const path = this.jsbundleUrl || 'file://'; | ||
const path = this.jsbundleUrl ?? 'file://'; | ||
return this.fromSource(path + getAssetPathInDrawableFolder(this.asset)); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters