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

Checkbox on iOS is not visible #2334

Closed
rumax opened this issue Nov 1, 2020 · 17 comments
Closed

Checkbox on iOS is not visible #2334

rumax opened this issue Nov 1, 2020 · 17 comments

Comments

@rumax
Copy link

rumax commented Nov 1, 2020

Current behaviour

Checkbox on iOS is no visible if not checked.

Expected behaviour

Code sample

Use the demo from docs

import * as React from 'react';
import { Checkbox } from 'react-native-paper';

const MyComponent = () => {
  const [checked, setChecked] = React.useState(false);

  return (
    <Checkbox
      status={checked ? 'checked' : 'unchecked'}
      onPress={() => {
        setChecked(!checked);
      }}
    />
  );
};

export default MyComponent;

Screenshots (if applicable)

Unchecked state:

Screenshot 2020-11-01 at 16 02 14

Checked state:

Screenshot 2020-11-01 at 18 44 20

What have you tried

Used official docs https://callstack.github.io/react-native-paper/checkbox.html

Also not style property to checkbox?

Screenshot 2020-11-01 at 18 47 31

Screenshot 2020-11-01 at 18 47 41

Your Environment

software version
ios or android iOS or web case with expo
react-native 0.63.3
react-native-paper 4.3.0
node v12.16.1
npm or yarn 6.13.4
expo sdk 39.0.0
@github-actions
Copy link

github-actions bot commented Nov 1, 2020

Couldn't find version numbers for the following packages in the issue:

  • react-native-vector-icons
  • expo
  • npm

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

The versions mentioned in the issue for the following packages differ from the latest versions on npm:

  • yarn (found: 6.13.4, latest: 1.22.10)

Can you verify that the issue still exists after upgrading to the latest versions of these packages?

@rumax
Copy link
Author

rumax commented Nov 1, 2020

Couldn't find version numbers for the following packages in the issue:
react-native-vector-icons

"react-native-vector-icons": "^7.1.0"

expo and NPM is in the issue description

@Selfmade-RuLeZ
Copy link

Selfmade-RuLeZ commented Nov 2, 2020

https://callstack.github.io/react-native-paper/checkbox.html

As you can see, it's the typical behavior. You have to wrap a box or anything by yourself.

Edit: Or just use <Checkbox.Android ... />

@rumax
Copy link
Author

rumax commented Nov 2, 2020

Hi @Selfmade-RuLeZ and thanks for your reply.

As you can see, it's the typical behavior.

can you, please, elaborate a bit more on what is the typical behaviour? If a user cannot see the element, where he should tap? I also tried to wrap the checkbox into the View with a background colour, but result is the same - element is not visible.

Edit: Or just use <Checkbox.Android ... />

On iOS? Why?

@Selfmade-RuLeZ
Copy link

Selfmade-RuLeZ commented Nov 2, 2020

The thing that I was pointing to, is that it's not a bug, it's a well formed implementation.
On iOS you should not use Checkboxes if you want to strictly fit their guidlines.
Here is a example of Material Design Cross Platform Adaption, there you can see the controls guideline

Edit:

Native platform switches should be used as they have matching functionality and presentation as Material switches.
Use switches instead of checkboxes and check mark lists instead of radio buttons as these are the graphics expected on iOS.

As mentioned on the material.io website

@rumax rumax closed this as completed Nov 2, 2020
@Selfmade-RuLeZ
Copy link

Selfmade-RuLeZ commented May 7, 2021

As I mentioned one post above, the CheckBox is implemented correctly, as iOS should not show boxes around CheckBoxes. On iOS you should use switches for most things.

@dfabreguette
Copy link

@Selfmade-RuLeZ ok so I'll need some specific iOS Code for each boolean form values ?

@Selfmade-RuLeZ
Copy link

Selfmade-RuLeZ commented May 7, 2021

Depends on the use case. You could life with the missing box, use switches for android too or implement specific code.

@dfabreguette
Copy link

alright, thanks for the quick answer, maybe it'd be good to mention it inside documentation

@butterfly-valley
Copy link

On iOS? Why?
Because on iOS it sucks.

@JooAndriano
Copy link

type mode="android"
the box will appear in ios...

@FaisalKhawaj
Copy link

You can always use <Checkbox.Android /> to just use the Android properties (ie. outlined unchecked box) on iOS devices.

@avalonder
Copy link

This was solved for me by implementing <Checkbox.Item> along with mode="android".

Example:

<Checkbox.Item 
         status={checked ? 'checked' : 'unchecked'}
         onPress={() => {
           setChecked(!checked);
         }}
         color="red"
         uncheckedColor="green"
         mode="android"
        />

@lasithalakmal
Copy link

You can always use <Checkbox.Android /> to just use the Android properties (ie. outlined unchecked box) on iOS devices.

Worked perfectly. Thanks

@ansarikhurshid786
Copy link

This was solved for me by implementing <Checkbox.Item> along with mode="android".

Example:

<Checkbox.Item 
         status={checked ? 'checked' : 'unchecked'}
         onPress={() => {
           setChecked(!checked);
         }}
         color="red"
         uncheckedColor="green"
         mode="android"
        />

solved my problem

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

11 participants