Nativebase: Checkbox checked icon is not visible when 'color' property is white

Created on 2 Jan 2019  路  4Comments  路  Source: GeekyAnts/NativeBase

I have gone through these following points

Checkbox check icon is not visible when color property is white.

node: 8.11.2, npm: 5.6.0, react-native:0.56.0, react: 16.4.1, native-base: 2.8.1, xcode: 10.0

Expected behaviour

screen3

Actual behaviour

screen2

Steps to reproduce

import React, {Component} from 'react';
import {View, Text, StyleSheet, Image} from 'react-native';
import { Container, Content, ListItem, CheckBox, Body } from 'native-base';





class FixCheckbox extends Component {

    static navigationOptions = {
        header: null
    };

    render() {
        return (
            <Container style={styles.container}>
                <Content>
                    <ListItem>
                        <CheckBox checked={true} />
                        <Body>
                            <Text>Daily Stand Up</Text>
                        </Body>
                    </ListItem>

                    <ListItem>
                        <CheckBox checked={true} color='white' />
                        <Body>
                        <Text>Checkbox when 'checked' is false</Text>
                        </Body>
                    </ListItem>
                </Content>
            </Container>
        )
    }
}

export default FixCheckbox;


const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#00c5cd',
        display: 'flex',
        flexDirection: 'row',
        alignItems: 'center',
        justifyContent: 'center',
        padding: 20,
    }
})

This problem is coming on both Ios and Android.

Checkbox check icon is by default white for all colors. For color property 'white', it becomes invisible.

Most helpful comment

Imo, please just expose checkboxTickColor as a prop so we don't have to go through the process of ejecting for a pretty basic customization.

All 4 comments

@madhav Refer to Customize section of native-base in docs
https://docs.nativebase.io/Customize.html#Customize
1)eject native-base-theme
2)change color for checkboxTickColor in platform.js/material.js/commoncolor.js within variables folder of native-base-theme
3)Then run the following code snippet in App.js

import React, { Component } from "react";
import { View, Text, StyleSheet, Image } from "react-native";
import {
  Container,
  Content,
  ListItem,
  CheckBox,
  Body,
  StyleProvider,
} from "native-base";
import getTheme from "./native-base-theme/components";
import material from "./native-base-theme/variables/platform";

class FixCheckbox extends Component {
  static navigationOptions = {
    header: null,
  };

  render() {
    return (
      <StyleProvider style={getTheme(material)}>
        <Container style={styles.container}>
          <Content>
            <ListItem>
              <CheckBox checked={true} />
              <Body>
                <Text>Daily Stand Up</Text>
              </Body>
            </ListItem>

            <ListItem>
              <CheckBox checked={true} color="white" />
              <Body>
                <Text>Checkbox when 'checked' is false</Text>
              </Body>
            </ListItem>
          </Content>
        </Container>
      </StyleProvider>
    );
  }
}

export default FixCheckbox;

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#00c5cd",
    display: "flex",
    flexDirection: "row",
    alignItems: "center",
    justifyContent: "center",
    padding: 20,
  },
});

screen shot 1440-04-27 at 1 24 07 am
screen shot 1440-04-27 at 1 18 52 am

Thank you

Imo, please just expose checkboxTickColor as a prop so we don't have to go through the process of ejecting for a pretty basic customization.

@JoeRoddy has a good point!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

natashache picture natashache  路  3Comments

sihemhssine picture sihemhssine  路  3Comments

Cotel picture Cotel  路  3Comments

Bundas picture Bundas  路  3Comments

inv2004 picture inv2004  路  3Comments