Nativebase: Why Drawer?

Created on 7 Nov 2016  ยท  19Comments  ยท  Source: GeekyAnts/NativeBase

If not exposed nor in the docs nor used internally.

Why this https://github.com/GeekyAnts/NativeBase/blob/97fce0c6b82ca0ef4f1adb29d27156640207feee/index.js#L74 ?

It's breaking mocha and jest tests because transpiler don't go this deep. Also, it's a dependency outside of the npm registry. Therefore, duplicated in most of the cases. Why it's in vendor?

Too many questions.

Most helpful comment

We've transpiled native-base to support es2015. It works but won't update :/

https://www.npmjs.com/package/native-base-es2015

We're probably dropping native-base in the following weeks. Doesn't feel like it's worth it.

All 19 comments

Note: it's not breaking the jest tests. But the tests are failing. For some reason jest-babel is not transpiling NativeBase. All other libs are working nice but not this one. Any idea?

is it working?

I guess it's working and used at:
http://nativebase.io/kitchen-sink-app

Here's a fork of the kitchen-sink-app showing the error: https://github.com/sospedra/NativeBase-KitchenSink

I just added jest and a very simple test. And it's failing miserably :)

@sospedra We will check it and update you soon.

Any response of this? I'm getting the same error on a fresh project.

Any update on this?

bump ^^

I have found a workaround, just mock the native-base classes in jest, like the react-native project does.

But a better solution is to provide npm prepublish script to build the project using Babel after install.

We've transpiled native-base to support es2015. It works but won't update :/

https://www.npmjs.com/package/native-base-es2015

We're probably dropping native-base in the following weeks. Doesn't feel like it's worth it.

@sospedra Sorry you feel that way. We understand that test cases are important. We are soon going to add jest support in a new version which will be going live in 2-3 weeks.

how can I mock jest classes? I having the same problem:

npm test

> [email protected] test /path/to/myapp
> jest

 FAIL  __tests__/index.ios.js
  โ— Test suite failed to run

    /path/to/myapp/node_modules/native-base/index.js:4
    import Drawer from './Components/vendor/react-native-drawer';
    ^^^^^^
    SyntaxError: Unexpected token import

      at transformAndBuildScript (node_modules/jest-runtime/build/transform.js:316:10)
      at Object.<anonymous> (jsx/SettingsPage.js:21:17)
      at Object.<anonymous> (index.ios.js:12:19)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        59.317s
Ran all test suites.
npm ERR! Test failed.  See above for more details.

We are soon going to add jest support in a new version which will be going live in 2-3 weeks.

@himanshu-satija, I see there have been 3 releases since this was posted, has this issue been fixed?

This is still a problem....any thoughts?

Nobody fix it. Therefore yes @shkfnly

Bump, I'm having this exact issue on a fresh project and will likely move on from nativebase without being able to write my tests with it.

Jest support has been added to 0.5.21. Please update and check.

Why not put react-native-drawer in package.json dependencies like react-native-vector-icons?

Fixed with 2.0.

  • Now we are exporting ES5 by default.
  • Added react-native-drawer as a dependency
Was this page helpful?
0 / 5 - 0 ratings

Related issues

maphongba008 picture maphongba008  ยท  3Comments

omerdn1 picture omerdn1  ยท  3Comments

muthuraman007 picture muthuraman007  ยท  3Comments

georgemickael-b picture georgemickael-b  ยท  3Comments

natashache picture natashache  ยท  3Comments