Coder Social home page Coder Social logo

Comments (12)

holymp2006 avatar holymp2006 commented on July 21, 2024 1

Ok, I think I see the problem.
You never said anything about installing as a nativescript plugin.
I installed as an npm package like the instruction says npm install nativescript-floatingactionbutton

tns install installs other dependencies too, in this case;
"Installing MNFloatingActionButton (0.1.5)

I installed as nativescript plugin,
tns plugin add nativescript-floatingactionbutton

...and everything works fine.
Thanks for the plugin, Brad. :)

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 21, 2024

Yep. Almost any plugin that is plain NATIVESCRIPT works with Angular. Make sure you run a full build after adding plugins with native deps and if using angular you'll need to use registerElement() like you mentioned.

from nativescript-floatingactionbutton.

holymp2006 avatar holymp2006 commented on July 21, 2024

thanks for the quick reply, Brad. I already did multiple full builds before reporting this. I'm not using angular. my project is just Typescript (that gets "compiled" to js). I don't know if I'm right, but I think a ".d.ts" file which contains the module declaration might be needed in the plugin folder. This is obtainable for other plugins I already use.

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 21, 2024

Not a requirement. Those are definition/declarations for typescript. I use it all the time. Most of my plugin repos have them. This was the first plugin I did and was in plain js. So having the .d.ts file will help but that's not the issue for anything failing and some IDEs resolve modules better than others. At any rate. I'm fairly certain I have this working with the latest NativeScript version since typescript wouldn't be involved with this plugin at any point. Also if a plugin is in typescript it should really only ship the transpiled .js to npm since TS isnt being ran through anything.

Sorry for the long message. Have you added the xmlns to the page component in your UI?

from nativescript-floatingactionbutton.

holymp2006 avatar holymp2006 commented on July 21, 2024

message wasn't long, I read everything. :) ..yes, I added the xmlns to page like you described in usage.
Just to be sure, below is the xml for the page.

<Page loaded="pageLoaded" 
    xmlns="http://schemas.nativescript.org/tns.xsd" 
    xmlns:FAB="nativescript-floatingactionbutton">
    <Page.actionBar>
        <ActionBar title="  "/>
    </Page.actionBar>
    <StackLayout orientation="vertical">
        <GridLayout>
            <GridLayout scaleX="1" scaleY="1" class="background"></GridLayout>
            <GridLayout scaleX="1" scaleY="1" class="background-overlay"></GridLayout>
            <GridLayout class="container" rows="70,auto,auto,*,20">
                <StackLayout row="1">
                    <TextField text="{{ verifyInput }}" id="verifyTextField" hint="xxxxxxx" autocorrect="false" autocapitalizationType="allCharacters" returnPress="verify" returnKeyType="go" />
                    <Button text="Verify" tap="verify" class="btn-primary btn-verify" />
                </StackLayout>
                <StackLayout row="2" verticalAlignment="bottom">
                    <Button text="+" tap="{{ gotoRegister }}" class="register-shortcut" horizontalAlignment="right" /> 
                </StackLayout>
                <StackLayout row="3" verticalAlignment="bottom">
                    <FAB:fab tap="{{ gotoRegister }}"
                     row="1"
                     icon="res://my_icon"
                     rippleColor="#f1f1f1"
                     class="fab-button" />
                </StackLayout>
            </GridLayout>
            <ActivityIndicator busy="{{ isLoading }}" />
        </GridLayout>
    </StackLayout>
</Page>

In the code, the Button just above your FAB, is what I currently use as my FAB. But I couldn't get the border radius to be perfect, so I need yours to work and save me. :)
I have fully built again, but the problem is still there.

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 21, 2024

from nativescript-floatingactionbutton.

holymp2006 avatar holymp2006 commented on July 21, 2024

ok. I built the new app like you suggested and used your XML. But at startup, the app crashes with the same error (JS ERROR Error: Building UI from XML. @file:///app/main-page.xml:12:13 ...) as the one I posted above.

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 21, 2024

I just cloned the repo and ran the demo app using the latest NS versions of everything. Can you show me the actual commands you run, in order from starting a new app and trying this plugin? Then we can compare and see where something might be wrong.

from nativescript-floatingactionbutton.

holymp2006 avatar holymp2006 commented on July 21, 2024

ok.
tns create my-app-name --template typescript
I cd into the app project folder and
tns install typescript
npm install nativescript-floatingactionbutton
paste your page code, change your loaded="pageLoaded" to their loaded="navigatingTo", as navigatingTo is the exported function in the template's "main-page.ts".
then
tns run ios

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 21, 2024

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 21, 2024

from nativescript-floatingactionbutton.

holymp2006 avatar holymp2006 commented on July 21, 2024

Alright Brad, :) PR submitted.

from nativescript-floatingactionbutton.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.