Skip to content

Commit 41bec3d

Browse files
EvanBaconCompuIves
authored andcommitted
Expo support (codesandbox#1807)
* Added support for Unimodules in the browser. * Add @EvanBacon as a contributor * Added Metro environment variable __DEV__ * Removed __DEV__ variable
1 parent c58a680 commit 41bec3d

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,15 @@
11671167
"contributions": [
11681168
"code"
11691169
]
1170+
},
1171+
{
1172+
"login": "EvanBacon",
1173+
"name": "Evan Bacon",
1174+
"avatar_url": "https://avatars1.githubusercontent.com/u/9664363?v=4",
1175+
"profile": "https://twitter.com/baconbrix",
1176+
"contributions": [
1177+
"code"
1178+
]
11701179
}
11711180
],
11721181
"repoType": "github",

README.md

Lines changed: 20 additions & 3 deletions
Large diffs are not rendered by default.

packages/app/src/sandbox/eval/presets/create-react-app/index.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,20 @@ export default function initialize() {
1414
const preset = new Preset(
1515
'create-react-app',
1616
['web.js', 'js', 'json', 'web.jsx', 'jsx', 'ts', 'tsx'],
17-
{ 'react-native': 'react-native-web' },
17+
{
18+
// Directly match react-native to react-native-web.
19+
// Attempt to use react-native internals shouldn't work on web.
20+
'react-native$': 'react-native-web',
21+
// Alias core react-native internals to react-native-web equivalents
22+
'react-native/Libraries/EventEmitter/RCTDeviceEventEmitter$': 'react-native-web/dist/vendor/react-native/NativeEventEmitter/RCTDeviceEventEmitter',
23+
'react-native/Libraries/vendor/emitter/EventEmitter$': 'react-native-web/dist/vendor/react-native/emitter/EventEmitter',
24+
'react-native/Libraries/vendor/emitter/EventSubscriptionVendor$': 'react-native-web/dist/vendor/react-native/emitter/EventSubscriptionVendor',
25+
'react-native/Libraries/EventEmitter/NativeEventEmitter$': 'react-native-web/dist/vendor/react-native/NativeEventEmitter',
26+
// Alias core react-native asset management internals to unimodule equivalents.
27+
'react-native/Libraries/Image/AssetSourceResolver$': 'expo-asset/build/AssetSourceResolver',
28+
'react-native/Libraries/Image/assetPathUtils$': 'expo-asset/build/Image/assetPathUtils',
29+
'react-native/Libraries/Image/resolveAssetSource$': 'expo-asset/build/resolveAssetSource',
30+
},
1831
{
1932
hasDotEnv: true,
2033
setup: manager => {

0 commit comments

Comments
 (0)