alinz / react-native-tabbar

Tab bar with more freedom
MIT License
265 stars 49 forks source link

Uncaught TypeError: glypyMapMaker is not a function #17

Closed peter-stanev closed 8 years ago

peter-stanev commented 8 years ago

I included "react-native-tabbar": "^0.3.4" into my package.json. And I run 'npm install'.

And I used following code snippets in my application.

import Tabbar from 'react-native-tabbar';

let glypy = glypyMapMaker({
  Home: 'e900',
  Camera: 'e901',
  Stat: 'e902',
  Settings: 'e903',
  Favorite: 'e904',
});

let {
  Tab,
  RawContent,
  IconWithBar,
  glypyMapMaker
} = Tabbar;

// this block has error of 'undefined' function
let glypy = glypyMapMaker({
  Home: 'e900',
  Camera: 'e901',
  Stat: 'e902',
  Settings: 'e903',
  Favorite: 'e904',
});

But I get error of 'undefined' function. Looking for your help. Thanks

alinz commented 8 years ago

@peter-stanev

couple of things, you are defining glypyMapMaker after using it. Also, it is a good way to follow ES6/2015 of writing code as follows

//include  and define all variables and modules here
import Tabbar, { Tab, RawContent, IconWithBar, glypyMapMaker } from 'react-native-tabbar';

//now, you have all variables, modules are included here, let's use them
let glypy = glypyMapMaker({
  Home: 'e900',
  Camera: 'e901',
  Stat: 'e902',
  Settings: 'e903',
  Favorite: 'e904',
});

please close the ticket if you managed to fix this issue

one other thing, you have to add a font file to iOS and android project in order to see the fonts. Here's another tutorial that I always use for this matter.

peter-stanev commented 8 years ago

Hi, Ali. It works, I appreciate your help. But when I click the one of the item in the tabbar I get this error.

Error: One of the sources to assign has an enumerable key on the prototype chain. This is an edge case that we do not support. This error is a performance optimization and not spec compliant. stack: Object.assign index.ios.bundle:648 BananaSlugAbstractNodeMeasurer._measureNode backend.js:2512

backend.js:2403 Map.withMutations backend.js:3972 BananaSlugAbstractNodeMeasurer._measureNodes backend.js:2394 JSTimersExecution.callTimer index.ios.bundle:5880 Object.JSTimersExecution.callTimers index.ios.bundle:5900 MessageQueue.__callFunction index.ios.bundle:5511 index.ios.bundle:5447 URL: undefined line: undefined message: One of the sources to assign has an enumerable key on the prototype chain. This is an edge case that we do not support. This error is a performance optimization and not spec compliant. I am attaching the screenshots. ![simulator screen shot jan 27 2016 11 02 13 am](https://cloud.githubusercontent.com/assets/14987796/12608601/a14bb86e-c4e5-11e5-8fcd-c777ba78deeb.png) ![simulator screen shot jan 27 2016 11 03 37 am](https://cloud.githubusercontent.com/assets/14987796/12608602/a14d4ec2-c4e5-11e5-9e61-f9da74440da5.png)
peter-stanev commented 8 years ago

Don't worry about it now, I restarted the app and it's gone. i think it is react native error itself