Coder Social home page Coder Social logo

Comments (47)

marcelomiranda90 avatar marcelomiranda90 commented on July 20, 2024 7

Hello, I was able to change the background color by changing the value of the ns_accent item in app/ app_Resources/values-21/colors.xml

Example:

<?xml version="1.0" encoding="utf-8"?> <resources> <color name="ns_accent">#757575</color> </resources>

I hope it works for you too! ;)

from nativescript-floatingactionbutton.

hshristov avatar hshristov commented on July 20, 2024 5

Fixed with NativeScript/NativeScript#4959

from nativescript-floatingactionbutton.

tigrenok00 avatar tigrenok00 commented on July 20, 2024 3

I also have installed 3.2 today and the problem still exists

from nativescript-floatingactionbutton.

tigrenok00 avatar tigrenok00 commented on July 20, 2024 2

@bradmartin We've shared the project with you at [email protected], would you please take a look?
Thank you!

from nativescript-floatingactionbutton.

hshristov avatar hshristov commented on July 20, 2024 2

So it seems Android team is doing the same mistake like us. The newInstance method is not implemented by all Drawables so it throws an exception internally. I guess the only solution we have is to wrap it in a try/catch block.

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 20, 2024 2

Absolutely, I don't have the time currently to help on it but once a solution is found if it requires updating the plugin I'll make sure it happens.

from nativescript-floatingactionbutton.

sudhanshu-15 avatar sudhanshu-15 commented on July 20, 2024 1

Updated to 3.2 and facing same issues on Android. iOS seems to work fine.

from nativescript-floatingactionbutton.

tigrenok00 avatar tigrenok00 commented on July 20, 2024 1

Unfortunately, those steps did not help for me :(

from nativescript-floatingactionbutton.

sudhanshu-15 avatar sudhanshu-15 commented on July 20, 2024 1

@bradmartin I too followed the steps right now, nuked the node_modules, removed tns-core-modules, removed platforms, updated and reran the application. Still gives me the same error.

tns info gives me:

┌──────────────────┬─────────────────┬────────────────┬─────────────┐
│ Component        │ Current version │ Latest version │ Information │
│ nativescript     │ 3.2.0           │ 3.2.0          │ Up to date  │
│ tns-core-modules │ 3.2.0           │ 3.2.0          │ Up to date  │
│ tns-android      │ 3.2.0           │ 3.2.0          │ Up to date  │
│ tns-ios          │ 3.2.0           │ 3.2.0          │ Up to date  │
└──────────────────┴─────────────────┴────────────────┴─────────────┘

tns-nativescriptactivity-09122017104551

Interestingly enough once I removed the background color from the css it started working fine. The moment I added the background color it started throwing the error.

tns-nativescriptactivity-09122017105405

from nativescript-floatingactionbutton.

sudhanshu-15 avatar sudhanshu-15 commented on July 20, 2024 1

@marcelomiranda90 the trick did the job. @bradmartin I tried using backgroundColor in the CSS and it threw an error.

from nativescript-floatingactionbutton.

andreacappadona17 avatar andreacappadona17 commented on July 20, 2024

I'm having the same problem, but only when I set a background-color in the css class for the button.
With no background-color property, it works just fine.

from nativescript-floatingactionbutton.

SP1966 avatar SP1966 commented on July 20, 2024

I believe that the same issue is affecting nativescript-cardview:
nstudio/nativescript-cardview#64

In both cases, cardview and floatingactionbutton if the background-color is set in CSS the app crashes. Remove the CSS and all is well, except the background-color is wrong! :)

from nativescript-floatingactionbutton.

sagar1911 avatar sagar1911 commented on July 20, 2024

Hi @andreacappadona17 ,
then how can I change the bg color of FAB button ?? Is there any alternative ??

from nativescript-floatingactionbutton.

sagar1911 avatar sagar1911 commented on July 20, 2024

Hey @andreacappadona17 ,
and it is moving according to the scroll I want it to be fixed even the user scrolls the page. How can I do that ??

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 20, 2024

Try using a previous version of the core-modules and see if it doesn't crash with the background color. I have core-modules 3.1.0 with ios runtime 3.1.0 and android runtime 3.1.1 and I can change the background color of the FAB just fine and have pushed two apps in the previous week. Haven't looked into the issue much because I haven't had this issue myself. @sagar1911 as far as it moving when you scroll, just dont set the hideOnSwipeOfView or animation for that and it shouldn't move. I don't move it in my app and I use the same code on the README with no issue. Hope that helps.

from nativescript-floatingactionbutton.

sagar1911 avatar sagar1911 commented on July 20, 2024

from nativescript-floatingactionbutton.

Acanguven avatar Acanguven commented on July 20, 2024

Removing background-color solves the problem. A fix for this would be great.

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 20, 2024

NativeScript/NativeScript#4728 (comment)

from nativescript-floatingactionbutton.

SP1966 avatar SP1966 commented on July 20, 2024

I just installed 3.2 and unless I've done something wrong the problem persists.

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 20, 2024

Has anyone nuked their node_modules, cleaned the platform folder, updated runtimes, core-modules and then performed a full rebuild and install? I've just updated an app to 3.2.0 and I don't have any issue.

    <FAB row="0" rowSpan="2" col="0" (tap)="takePhoto() " icon="res://ic_photo_camera_white" rippleColor="#f1f1f1" class="take-picture-fab-button"></FAB>
.take-picture-fab-button {
  background-color: #ff4081;
  vertical-align: bottom;
  horizontal-align: right;
  height: 60;
  width: 60;
  margin: 10 15 5% 10;
}

I've navigated to and from multiple pages with the FAB on them. I've changed the background-color and let livesync run and it never throws the error.

If an uninstall, nuke, rebuild, & run doesn't fix this for those still experiencing the issue we might need to get a simple demo app to send to the core team. I wish I had an error but in my apps all seems fine, sorry everyone still having issues. Hopefully the steps mentioned here will help.

from nativescript-floatingactionbutton.

tigrenok00 avatar tigrenok00 commented on July 20, 2024

@bradmartin We think we have a working project that reproduces the issue, can you please give an email to share it with on Google Drive?

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 20, 2024

First thing I noticed in that project, you're on core-modules 3.1.1 - I'm about to build it and run it, so will update soon. @tigrenok00

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 20, 2024

fab

It works as expected with 3.2.0 core-modules which contains the fix for the issue in 3.1 core-modules. @tigrenok00 - so delete node_modules and set the core-modules to 3.2.0 in the package.json, then tns run android and it will install the 3.2 core-modules and it should work.

Let me know how it goes 😄

from nativescript-floatingactionbutton.

tigrenok00 avatar tigrenok00 commented on July 20, 2024

Do you receive an error about Drawable in the console? We do

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 20, 2024

iconresource

With resource icon on the FAB ^^^.

Yes, there is some drawable exception in the console that seems to be printing. I'm not sure what's causing that but at least the FAB will render. Figuring out that exception will take more time to debug and I currently don't have extra time to look into it, sorry. Would be happy if someone else has any time to debug it and see where it's thrown from.

from nativescript-floatingactionbutton.

tigrenok00 avatar tigrenok00 commented on July 20, 2024

In our original project we have a crush with the error shown on the original post screenshot. In the example project there is no crush but the error is seen in the console.
What would you suggest us do? We cannot upload the original project as is right now...

from nativescript-floatingactionbutton.

tigrenok00 avatar tigrenok00 commented on July 20, 2024

Sorry, just saw your comment about tns-core-modules. In the original project it is 3.2.0 already (the one with the crash), we just updated the example one and it behaves as said - no crash, but error in console. I'm not sure why the original project is different.

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 20, 2024

from nativescript-floatingactionbutton.

sudhanshu-15 avatar sudhanshu-15 commented on July 20, 2024

Here you go
image

This was taken from https://material.io/icons/#ic_add

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 20, 2024

Yep all good there. What is the color value in your css? I use hex values and it doesn't throw that exception. Also, can you try on various android APIs and see if you can isolate maybe a specific API? First thing I'd try is to clone the repo and run the demo app. If the demo app runs then you can start isolating your issue to something in your application. So lets try that first and let me know how it goes please 😄

from nativescript-floatingactionbutton.

tigrenok00 avatar tigrenok00 commented on July 20, 2024

Did anyone manage to solve the problem?

from nativescript-floatingactionbutton.

sudhanshu-15 avatar sudhanshu-15 commented on July 20, 2024

@bradmartin the color value is #7D110C. I am trying to check with the different android APIs and get back to you. I will also try to clone the demo app and try. Sorry for the delay, I had been away from a day.

from nativescript-floatingactionbutton.

sudhanshu-15 avatar sudhanshu-15 commented on July 20, 2024

UPDATE: Tried running the demo app and it gave me the same error.
Removing background-color from css fixes it.

from nativescript-floatingactionbutton.

tigrenok00 avatar tigrenok00 commented on July 20, 2024

Hi @bradmartin , do you have any advice for us?

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 20, 2024

Hi @tigrenok00 - I currently don't. I did meet @sudhanshu-15 at the developer day conference and discussed it. I'll probably take a look at this later this week or early next.

from nativescript-floatingactionbutton.

sudhanshu-15 avatar sudhanshu-15 commented on July 20, 2024

from nativescript-floatingactionbutton.

jukkaisosomppi avatar jukkaisosomppi commented on July 20, 2024

It seems to be problem at least on android 6 version. 3.2 core-modules fixed it on android 7 and 4.4.4 at least. Removing background-color from .fab-button fixes it and it takes color from ns_primary or ns_accent from manifest

from nativescript-floatingactionbutton.

sudhanshu-15 avatar sudhanshu-15 commented on July 20, 2024

@bradmartin @jukkaisosomppi I can confirm @jukkaisosomppi hypothesis of the problem being on Android 6. I deployed on my Android 7 device and emulator and it seems to be working fine, while it crashes on my other device running android 6.

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 20, 2024

from nativescript-floatingactionbutton.

hshristov avatar hshristov commented on July 20, 2024

@jukkaisosomppi @sudhanshu-15 If anyone could attach a project that reproduce it or at least steps to repro please do so. I will take a look.

from nativescript-floatingactionbutton.

jukkaisosomppi avatar jukkaisosomppi commented on July 20, 2024

Hi, here is example app.

android6_problem.zip

from nativescript-floatingactionbutton.

tigrenok00 avatar tigrenok00 commented on July 20, 2024

@bradmartin Hi, if the problem is found, any chance for an update to fix this on android 6? Thanks!

from nativescript-floatingactionbutton.

tigrenok00 avatar tigrenok00 commented on July 20, 2024

I hoped to set the color we need in ns_primary or ns_accent until the fix, but it has no impact... (I'm using a theme, and it looks like regardless of which theme it is, the default FAB color is the same)

from nativescript-floatingactionbutton.

adolfos94 avatar adolfos94 commented on July 20, 2024

Hello guys, I have the same issue. Actually my app is published. The problem here is in some devices on Android, the background-color works perfectly on other devices doesn't work. Any idea how to fix it ?

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 20, 2024

For now the best approach across all android APIs IMO is to use the ns_accent color which will be used by the android theme for FAB buttons in the support design library. This will allow you not to code a backgroundColor on the FAB for now to avoid the crash.

Has anyone confirmed on Android 6 if using backgroundColor in the markup works or does that still cause the exception to throw?

from nativescript-floatingactionbutton.

adolfos94 avatar adolfos94 commented on July 20, 2024

Thanks @marcelomiranda90 your fix worked like a charm.

from nativescript-floatingactionbutton.

bradmartin avatar bradmartin commented on July 20, 2024

Confirmed the fix is good, thanks @hshristov

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.