Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floating Action Button not working #66

Closed
charlessabenin opened this issue Dec 1, 2017 · 3 comments
Closed

Floating Action Button not working #66

charlessabenin opened this issue Dec 1, 2017 · 3 comments

Comments

@charlessabenin
Copy link

Hi, i am using nativescript with javascript and i am trying to add floating Action Button but it is not working.
After following steps with : https://github.com/bradmartin/nativescript-floatingactionbutton/blob/master/README.md
i have a white screen and this message : Cannot read property 'FloatinActionButton' of undefined, undefined

can anybody help please!

@bradmartin
Copy link
Collaborator

Can you share the markup you have? Also the commands executed and if you rebuilt the app?

@chuckmitchell
Copy link

I Have the same issue, but with {N} Angular/

Do I add the Element registration code to main.ts, before the following line?

platformNativeScriptDynamic().bootstrapModule(AppModule);

This is the code I'm talking about:

import {registerElement} from "nativescript-angular/element-registry";
registerElement("FAB", () => require("nativescript-floatingactionbutton").Fab);`

I'm getting an error when loading the page stating

Cannot read property "FloatingActionButton" of undefined, undefined.

HTML:
https://paste.ofcode.org/UMwk44gTkCtwbR9KfC2dh8

TS:
https://paste.ofcode.org/uFTEYn6wV65LgPG9ZtbKju

@bradmartin
Copy link
Collaborator

Do it in app.component like the below example from a working production app:

import { registerElement } from "nativescript-angular/element-registry";
import { TextInputLayout } from "nativescript-textinputlayout";
registerElement("Fab", () => Fab);
registerElement("MapView", () => MapView);
registerElement("TextInputLayout", () => TextInputLayout);
// tslint:disable-next-line:no-require-imports
registerElement("Gradient", () => require("nativescript-gradient").Gradient);

// app
import { ActionBarUtil } from "./utils";
import * as frescoModule from "nativescript-fresco";

@Component({
  selector: "ns-app",
  template: "<page-router-outlet></page-router-outlet>"
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants