-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: polyfill expo-file-system and expo-clipboard to work with weshnet (
#941)
- Loading branch information
1 parent
191ef78
commit f325a90
Showing
14 changed files
with
111 additions
and
9 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as ExpoClipboard from "expo-clipboard"; | ||
import Constants from "expo-constants"; | ||
const isRunningInExpoGo = Constants.appOwnership === "expo"; | ||
|
||
let Clipboard; | ||
|
||
if (isRunningInExpoGo) { | ||
Clipboard = ExpoClipboard; | ||
} else { | ||
const moduleName = "@react-native-clipboard/clipboard"; | ||
Clipboard = require(moduleName).default; | ||
Clipboard.setStringAsync = Clipboard.setString; | ||
Clipboard.getStringAsync = Clipboard.getString; | ||
} | ||
|
||
export default Clipboard; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import * as Clipboard from "expo-clipboard"; | ||
|
||
export default Clipboard; |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Constants from "expo-constants"; | ||
import * as ExpoFileSystem from "expo-file-system"; | ||
|
||
const isRunningInExpoGo = Constants.appOwnership === "expo"; | ||
|
||
let FileSystem = ExpoFileSystem; | ||
|
||
if (isRunningInExpoGo) { | ||
FileSystem = ExpoFileSystem; | ||
} else { | ||
const moduleName = "react-native-fs"; | ||
const RNFS = require(moduleName); | ||
//TODO: patch other expo file system functions | ||
FileSystem = { | ||
...ExpoFileSystem, | ||
readAsStringAsync: async (uri, options) => { | ||
console.log("here test"); | ||
return await RNFS.readFile(uri, options?.encoding); | ||
}, | ||
}; | ||
} | ||
|
||
export default FileSystem; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import * as FileSystem from "expo-file-system"; | ||
|
||
export default FileSystem; |
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