1

The Scenario

I am writing an React-Native-Web (RNW) app. The basic design is a core application that takes a library of custom React-Native components as a node package.

The component library is also an RNW app as i use StoryBook to allow development in isolation.

The Issue

When i install the component library from git using npm i ... into the core application and import it into the App.js in the src folder i get the following error...

ReferenceError: Can't find variable: Symbol

This error is located at:
    in Styled(SimpleList) (created by App)
    in RCTView (created by View)
    in View (created by App)
    in App (created by NativeApp)
    in NativeApp
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer

I have also tried to install es6-symbol but this doesn't seem to have any affect.

enter image description here

Any suggestions please?

2
  • Have you imported es6-symbol? If yes, how? Commented May 24, 2018 at 9:04
  • Yes, i imported it into the App.js using import 'es6-symbol/implement'; FYI, it seems to only be an android issue, the solution works for ios Commented May 24, 2018 at 9:17

3 Answers 3

4

you need to

npm install es6-symbol --save

and then inside index.android.js & index.ios.js

import 'es6-symbol/implement'

If its only causing problems in android you might want to add this in index.android.js

import 'core-js/es6/symbol';

import 'core-js/fn/symbol/iterator';

import "core-js/es6/set";

issue

Sign up to request clarification or add additional context in comments.

3 Comments

thanks for the suggestion. I have tried both with es6-symbol and core-js but neither solutions work :( FYI, this only occurs in Android
i imported it into the index.android.js in the root, i also tried it in the index.android.js in to src directory, neither worked unfortunatly
@supra28 I have tried both but after adding it the new error is: "Cant find variable: WeakSet" any idea how to solve it?
0

Thanks to @supra28 for the solution. The only change i had to make was to add

import 'core-js/es6/symbol';

import 'core-js/fn/symbol/iterator';

import "core-js/es6/set";

to the app.js instead of the index.android.js. This solution works for both ios and android

Comments

0

import these in your root index.js file:

import "core-js/stable";
import "regenerator-runtime/runtime";

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.