-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add `@babel/runtime` as dependancy * Revert "Add `@babel/runtime` as dependancy" This reverts commit 693d8c5. * `disableImportExportTransform` in babel config * Fix to tests * Change how reanimated is polyfilled
- Loading branch information
1 parent
2a8f8b7
commit d6460cc
Showing
9 changed files
with
116 additions
and
44 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 |
---|---|---|
@@ -1,7 +1,23 @@ | ||
module.exports = { | ||
presets: ["module:metro-react-native-babel-preset"], | ||
plugins: [ | ||
"@babel/plugin-proposal-export-namespace-from", | ||
"react-native-reanimated/plugin", | ||
], | ||
module.exports = (api) => { | ||
const isTest = api.env("test"); | ||
|
||
return { | ||
presets: [ | ||
[ | ||
"module:metro-react-native-babel-preset", | ||
{ | ||
/** | ||
* Addresses issue caused on snack that leads to `Unable to resolve module 'app/node_modules/@babel/runtime/helpers/interopRequireDefault.js'` | ||
* See: https://github.com/expo/snack/pull/302 | ||
* Always false for tests for jest to work | ||
*/ | ||
disableImportExportTransform: !isTest, | ||
}, | ||
], | ||
], | ||
plugins: [ | ||
"@babel/plugin-proposal-export-namespace-from", | ||
"react-native-reanimated/plugin", | ||
], | ||
}; | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,19 @@ | ||
module.exports = { | ||
presets: ["module:metro-react-native-babel-preset"], | ||
module.exports = (api) => { | ||
const isTest = api.env("test"); | ||
|
||
return { | ||
presets: [ | ||
[ | ||
"module:metro-react-native-babel-preset", | ||
{ | ||
/** | ||
* Addresses issue caused on snack that leads to `Unable to resolve module 'app/node_modules/@babel/runtime/helpers/interopRequireDefault.js'` | ||
* See: https://github.com/expo/snack/pull/302 | ||
* Always false for tests for jest to work | ||
*/ | ||
disableImportExportTransform: !isTest, | ||
}, | ||
], | ||
], | ||
}; | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,19 @@ | ||
module.exports = { | ||
presets: ["module:metro-react-native-babel-preset"], | ||
module.exports = (api) => { | ||
const isTest = api.env("test"); | ||
|
||
return { | ||
presets: [ | ||
[ | ||
"module:metro-react-native-babel-preset", | ||
{ | ||
/** | ||
* Addresses issue caused on snack that leads to `Unable to resolve module 'app/node_modules/@babel/runtime/helpers/interopRequireDefault.js'` | ||
* See: https://github.com/expo/snack/pull/302 | ||
* Always false for tests for jest to work | ||
*/ | ||
disableImportExportTransform: !isTest, | ||
}, | ||
], | ||
], | ||
}; | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,19 @@ | ||
module.exports = { | ||
presets: ["module:metro-react-native-babel-preset"], | ||
module.exports = (api) => { | ||
const isTest = api.env("test"); | ||
|
||
return { | ||
presets: [ | ||
[ | ||
"module:metro-react-native-babel-preset", | ||
{ | ||
/** | ||
* Addresses issue caused on snack that leads to `Unable to resolve module 'app/node_modules/@babel/runtime/helpers/interopRequireDefault.js'` | ||
* See: https://github.com/expo/snack/pull/302 | ||
* Always false for tests for jest to work | ||
*/ | ||
disableImportExportTransform: !isTest, | ||
}, | ||
], | ||
], | ||
}; | ||
}; |
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 |
---|---|---|
@@ -1,7 +1,23 @@ | ||
module.exports = { | ||
presets: ["module:metro-react-native-babel-preset"], | ||
plugins: [ | ||
"@babel/plugin-proposal-export-namespace-from", | ||
"react-native-reanimated/plugin", | ||
], | ||
module.exports = (api) => { | ||
const isTest = api.env("test"); | ||
|
||
return { | ||
presets: [ | ||
[ | ||
"module:metro-react-native-babel-preset", | ||
{ | ||
/** | ||
* Addresses issue caused on snack that leads to `Unable to resolve module 'app/node_modules/@babel/runtime/helpers/interopRequireDefault.js'` | ||
* See: https://github.com/expo/snack/pull/302 | ||
* Always false for tests for jest to work | ||
*/ | ||
disableImportExportTransform: !isTest, | ||
}, | ||
], | ||
], | ||
plugins: [ | ||
"@babel/plugin-proposal-export-namespace-from", | ||
"react-native-reanimated/plugin", | ||
], | ||
}; | ||
}; |
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
25 changes: 0 additions & 25 deletions
25
packages/ui/scripts/polyfillReanimatedWorkletInitForSnack.ts
This file was deleted.
Oops, something went wrong.
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 @@ | ||
/** | ||
* When the @draftbit/ui is used with snack, we run into the error: 'r.g.__reanimatedWorkletInit is not a function' | ||
* The solution is to add a polyfill for the global.__reanimatedWorkletInit function | ||
* https://forums.expo.dev/t/react-native-reanimated-error-r-g-reanimatedworkletinit-is-not-a-function/68222/3 | ||
* | ||
* This polyfill needs to be done at the first point of execution, placing at the top of index.tsx does not guarantee that | ||
* since the build reorders the code around (such as hoisting imports/exports) which results in it not being the top most call. Having it as an import of | ||
* a seperate file guarantees it's the first import | ||
* | ||
*/ | ||
|
||
//@ts-ignore | ||
if (!global.__reanimatedWorkletInit) { | ||
//@ts-ignore | ||
global.__reanimatedWorkletInit = function () {}; | ||
} |