NativeBase: WARN "We can not support a function callback..."

Description

We expected no console warning with minimal Checkbox.Group usage.

CodeSandbox/Snack link

no link

Steps to reproduce

export const CheckboxScreen = () => {
   const [values, setValues] = useState(['test']);

   return (
      <View>
         <Checkbox.Group onChange={v => setValues(v)} defaultValue={values}>
            <Checkbox value={'test'}>Test</Checkbox>
         </Checkbox.Group>
         <Text>{values}</Text>
      </View>
   );
};

NativeBase Version

3.4.7

Platform

  • Android
  • CRA
  • Expo
  • iOS
  • Next

Other Platform

No response

Additional Information

We are getting following warning “WARN We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320” when clicking the checkbox in the group. Without checkbox group there is no warning. Is this an issue or are we doing something wrong?

Versions:

  • react-native: 0.67.4

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 40
  • Comments: 62

Most upvoted comments

Use onToggle instead of onValueChange.

Having to source a third party checkbox because of a bug with a simple component, which has been around since June, or possibly longer. How utterly ridiculous is that?

3.4.17

Any news? Still present and kinda annoying.

+1 “native-base”: “3.4.9”, “react”: “17.0.2”, “react-native”: “0.68.2”,

+1 “react”: “18.1.0”, “react-native”: “0.70.5”, “native-base”: “^3.4.25”,

Should we abandon native base?

wow been 8 months and the issue still going

This issue was “closed this as completed in https://github.com/adobe/react-spectrum/pull/2304on Jan 11, 2022

❯ yarn why @react-aria/checkbox
yarn why v1.22.19
[1/4] 🤔  Why do we have the module "@react-aria/checkbox"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@react-aria/checkbox@3.9.1"
info Reasons this module exists
   - "native-base#@react-native-aria#checkbox" depends on it
   - Hoisted from "native-base#@react-native-aria#checkbox#@react-aria#checkbox"
info Disk size without dependencies: "188KB"
info Disk size with unique dependencies: "1.9MB"
info Disk size with transitive dependencies: "4.35MB"
info Number of shared dependencies: 16
✨  Done in 0.28s.

native-base is dependent on specific versions of @react-stately that have been superseded years ago

    "@react-stately/checkbox": "3.0.3",
    "@react-stately/collections": "3.3.0",
    "@react-stately/combobox": "3.0.0-alpha.1",
    "@react-stately/radio": "3.2.1",
    "@react-stately/slider": "3.0.1",
    "@react-stately/tabs": "3.0.0-alpha.1",
    "@react-stately/toggle": "3.2.1",

As for @react-spectrum (which contains @react-stately) there have been a number of subsequent releases:

- @react-stately/checkbox@3.4.2
- @react-stately/collections@3.8.0
- @react-stately/combobox@3.5.1
- @react-stately/radio@3.8.1
- @react-stately/slider@3.3.2
- @react-stately/tabs@3.4.1

Indeed on March 4, 2023 @mfarhankasmani made an update to solve this exact issue by updating @react-stately/checkbox to version 3.4.0 (also memoizes the function).

fix: CheckBox.Group bugs #5073 #5686 https://github.com/GeekyAnts/NativeBase/commit/ffbc6023565485d99734383d2c575aaa72d7f767

I’ve switched to https://github.com/WrathChaos/react-native-bouncy-checkbox instead. Simple, worked as expected. Barely need to look at the docs to use it.

Maybe NativeBase should look into implementing something a long that line. It’s just a checkbox, I was that close to just use 2 icons and bind it to a boolean.

+1 “react”: “18.0.0”, “react-native”: “0.69.4”, “native-base”: “^3.4.12”

+1 react-native 0.69.6, native base ^3.4.9

+1 rn 0.70

Same problem here!

Hi @Brma1048 , Thank you for reporting this issue. we will look into it.