react-native-community/CheckBox can't resolve module

Viewed 4116

It looks like an easy question with an easy answer i.e. npm install @react-native-community/checkbox but it doesn't work. I had an error saying that the package had a dependency to react-native-windows, so I also downloaded this package which lead to not solving my issue.

I really don't get why it happens...

Here is my package.json:

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@react-native-community/checkbox": "^0.5.6",
    "expo": "~39.0.2",
    "expo-status-bar": "~1.0.2",
    "moviedb-promise": "^3.1.2",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-image": "^4.0.3",
    "react-native": "https://github.com/expo/react-native/archive/sdk-39.0.2.tar.gz",
    "react-native-web": "~0.13.12",
    "react-native-windows": "^1.0.0",
    "react-tinder-card": "^1.3.1"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0"
  },
  "private": true
}

EDIT enter image description here

Here is my code:

import React from 'react'
import { View, Text } from 'react-native';
import CheckBoxSetting from './CheckBoxSetting';
import PressableSetting from './PressableSetting'
import SwitchSetting from './SwitchSetting';

function SettingItemFactory () {
    this.createSettingItem  = function (name, type, initState) {
        let settingItem = <Text/>;
        switch(type){
            case 'pressable':
                settingItem = <PressableSetting title={name}/>;
                break;
            case 'switch':
                settingItem = <SwitchSetting name={name} state={initState}/>
                break;
            case 'check':
                settingItem = <CheckBoxSetting name={name} state={initState}/>
                break;
            default:
                settingItem = <PressableSetting title={name} />;
        }
        return settingItem;
    }
}

export default SettingItemFactory;

import React from 'react'
import {View, Text, ImagePropTypes} from 'react-native'
import CheckBox from '@react-native-community/checkbox'


const CheckBoxSetting = (props) => {
    return (
        <View>
            <Text>
                {props.name}
            </Text>
        </View>
    )
}

export default CheckBoxSetting;
3 Answers

The answer was given by Tushar Khatiwada in the comments of the original post: As of right now, the library isn't supported by expo. Thanks Tushar!

It's not supported in the expo. in react-native CLI, make sure linking is done and do pod install.

Related