NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

Button text color is black?

Open nolan-m opened this issue 9 years ago • 23 comments

I've been using this library for a few weeks and everything looked like the docs. Now, for some reason the button color has switched to black. The disabled button is rendering opposite color schemes. (Grey on false, colored on true). I didn't change my version so I'm wondering what conflicted with this library to do this. Anyone had this happen?

import {
  Text,
  Button
} from 'native-base';

<Button
    block
    info
    onPress={ this._handleContinuePress }>
<Text>Continue</Text>
</Button>

screen shot 2017-03-28 at 3 17 33 pm

nolan-m avatar Mar 28 '17 22:03 nolan-m

@nolan-m I have same problem !. have you solved this??

iiitmahesh avatar Mar 29 '17 15:03 iiitmahesh

@iiitmahesh Nope, I'm about ready to remove NativeBase and create my own components since I can't figure out why this changed.

nolan-m avatar Mar 29 '17 15:03 nolan-m

same issue , waiting feedback

farahty avatar Mar 29 '17 18:03 farahty

Just noticed the Segment is messed up as well.

screen shot 2017-03-29 at 5 14 29 pm

nolan-m avatar Mar 30 '17 00:03 nolan-m

@nolan-m Which version are you on?

himanshu-satija avatar Mar 30 '17 06:03 himanshu-satija

@himanshu-satija 2.1.0

nolan-m avatar Mar 30 '17 15:03 nolan-m

I removed all dependencies to see if something was conflicting, but no luck.

  "dependencies": {
    "babel": "^6.23.0",
    "moment": "^2.18.1",
    "native-base": "^2.1.0",
    "react": "15.4.2",
    "react-native": "^0.42.3",
    "react-navigation": "^1.0.0-beta.6",
    "react-redux": "^5.0.3",
    "redux": "^3.6.0",
    "redux-thunk": "^2.2.0"
  },
  "devDependencies": {
    "babel-jest": "19.0.0",
    "babel-plugin-module-resolver": "^2.5.0",
    "babel-preset-react-native": "1.9.1",
    "jest": "19.0.2",
    "react-native-cli": "^2.0.1",
    "react-test-renderer": "15.4.2"
  },

nolan-m avatar Mar 30 '17 15:03 nolan-m

Did some more digging around. Looked at a demo project that I knew had the correct colors. Downgraded my version to specifically 2.0.11 (without ^). Hoping someone with more knowledge of this project can figure out what is conflicting between newer version.

    "native-base": "2.0.11",

nolan-m avatar Mar 30 '17 16:03 nolan-m

Try uninstalling and reinstalling native-base (npm uninstall native-base && npm install native-base) and see if that fixes your issue.

If you have ejected native-base theme, try ejecting it again from the latest version.

himanshu-satija avatar Mar 30 '17 18:03 himanshu-satija

I did that first and nothing changed. Have not ejected.

nolan-m avatar Mar 30 '17 18:03 nolan-m

@nolan-m I tested this and I can confirm that this is a bug introduced in v2.1.0. Button text looks fine inside Content but gets incorrect style when used without Content.

It will be fixed in the next version.

himanshu-satija avatar Mar 31 '17 08:03 himanshu-satija

@nolan-m There was an issue in one of our dependencies which directly gets installed from GitHub. I have fixed it. Uninstalling and reinstalling native-base should fix your issue.

I know we should ideally release a patch but we'll go with a quick fix for now. Anyone facing this issue ( @nimerfarahty @iiitmahesh ) should run npm uninstall native-base && npm i native-base

himanshu-satija avatar Mar 31 '17 09:03 himanshu-satija

himanshu-satija's solution worked for me.

elinlindberg avatar Apr 04 '17 08:04 elinlindberg

npm uninstall native-base && npm i native-base

Didn't work for me unfortunately. Anything else to try?

mcapodici avatar Apr 09 '17 05:04 mcapodici

@mcapodici Try npm uninstall native-base @shoutem/theme && npm i native-base and let me know if it works.

You can also try removing node_modules and running npm install

himanshu-satija avatar Apr 13 '17 07:04 himanshu-satija

@himanshu-satija thanks for the tip.

That didn't work unfortunately either.

For further information I get this every time I do npm install:

npm WARN @shoutem/[email protected] requires a peer of react@^15.0.0 but none was installed.
npm WARN @shoutem/[email protected] requires a peer of react@^15.1.0 but none was installed.
npm WARN [email protected] requires a peer of react@^0.13.0 || ^0.14.0 || ^15.0.0 but none was installed.

And this is my package.json:

{
  "name": "WhoCanICall",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "immutability-helper": "^2.1.2",
    "moment": "^2.18.1",
    "moment-timezone": "^0.5.13",
    "native-base": "^2.1.1",
    "react": "16.0.0-alpha.6",
    "react-mixin": "^3.0.5",
    "react-native": "0.43.2",
    "react-native-communications": "^2.2.1",
    "react-timer-mixin": "^0.13.3"
  },
  "devDependencies": {
    "babel-jest": "19.0.0",
    "babel-preset-react-native": "1.9.1",
    "jest": "19.0.2",
    "react-test-renderer": "16.0.0-alpha.6"
  },
  "jest": {
    "preset": "react-native"
  }
}

mcapodici avatar Apr 13 '17 08:04 mcapodici

@mcapodici Try with NativeBase v2.1.2. If you had ejected native-base-theme earlier, try ejecting again.

If you're still facing issues, please post a code snippet.

himanshu-satija avatar Apr 17 '17 13:04 himanshu-satija

Closing this as the above solution should work.

shivrajkumar avatar Apr 24 '17 05:04 shivrajkumar

Not sure if it will help anyone else but realised I had this Issue because I was importing the Text component from 'react-native' rather than 'native-base'

ChrisLusted avatar Apr 24 '17 19:04 ChrisLusted

I had the same issue on NativeBase v2.3.3 and the work around is to add primary to text:

<Button primary>
    <Text primary>Click Me</Text>
</Button>

ghalex avatar Nov 07 '17 09:11 ghalex