React Native 0.46.1 does not support import/export generator functions
See original GitHub issueIs this a bug report?
yes
Have you read the Bugs section of the Contributing to React Native Guide?
yes
Environment
react-native -v
: 0.46.1node -v
: v7.10.0npm -v
: 4.2.0yarn --version
(if you use Yarn): 0.27.5
Then, specify:
- Target Platform (e.g. iOS, Android): Android
- Development Operating System (e.g. macOS Sierra, Windows 10): Ubuntu Linux 17.04
- Build tools (Xcode or Android Studio version, iOS or Android SDK version, if relevant):
Steps to Reproduce
(Write your steps here:)
-
Create empty react-native project
-
Add test.js in project root with generator function export: export function* doSomething() {console.log(‘test’);} export default {test: doSomething};
-
Change index.android.js to: import React from ‘react’; import {AppRegistry, Text} from ‘react-native’; import {doSomething} from “./test”; //neither this // import doSomething from “./test”; //nor this doen’t work
class GFTest extends React.Component { render(){return <Text>hi!</Text>} } AppRegistry.registerComponent(‘gf_test’, () => GFTest);
Expected Behavior
Expected to see screen with ‘hi!’ string on it
Actual Behavior
See error screen: E/ReactNativeJS(13905): undefined is not an object (evaluating ‘regeneratorRuntime.mark’) ExceptionsManager.js:63 Cannot read property ‘mark’ of undefined handleException @ ExceptionsManager.js:63 handleError @ InitializeCore.js:125 reportFatalError @ error-guard.js:44 guardedLoadModule @ require.js:121 _require @ require.js:110 (anonymous) @ index.android.bundle…&minify=false:52122 executeApplicationScript @ debuggerWorker.js:40 (anonymous) @ debuggerWorker.js:65
E/ReactNativeJS(13905): undefined is not a function (evaluating ‘this._lazyCallableModulesname’) ExceptionsManager.js:63 this._lazyCallableModules[name] is not a function handleException @ ExceptionsManager.js:63 handleError @ InitializeCore.js:125 reportFatalError @ error-guard.js:44 __guard @ MessageQueue.js:230 callFunctionReturnFlushedQueue @ MessageQueue.js:100 (anonymous) @ debuggerWorker.js:71
Reproducible Demo
Issue Analytics
- State:
- Created 6 years ago
- Reactions:13
- Comments:13 (1 by maintainers)
Top GitHub Comments
@UlfR why did you close this issue? shouldn’t this be supported in the latest version? isn’t downgrading just a temporary fix?
I had the same issue and solved this by using variables.
becomes: