ant-design / ant-design-mobile-rn

Ant Design for React Native
https://rn.mobile.ant.design/
MIT License
3.02k stars 609 forks source link

Error: Unable to resolve module classnames #1229

Closed student1060632fpt closed 1 year ago

student1060632fpt commented 2 years ago

Reproduction link

https://files.gitter.im/58ecaa31d73408ce4f57939e/kd2R/image.png

Steps to reproduce

  1. Install antd for react native in mobile like in https://rn.mobile.ant.design/docs/react/introduce
  2. Use Checkbox of @ant-design/react-native
    
    const HomeScreen:FC = ({ navigation }: any) => {
    const [checked, setChecked] = useState(false)
    return (
    <View style={styles.container}>
      <Checkbox
       onChange={event => {
        setChecked(event.target.checked );
       }}
        checked={checked}
      />
    </View>
    );
    };
    const styles = StyleSheet.create({
    container: {
    },
    });

export default HomeScreen;

3. Restart yarn and run react-native run-android to run the app in emulator
4. The node window display module

error: Error: Unable to resolve module classnames from C:\Users\hoa.nguyenlexuan\Desktop\vaultbox\Vaultbox-dev-Mobile\vaultbox_mobile\node_modules\@ant-design\react-native\lib\tag\index.js: classnames could not be found within the project or in these directories: node_modules\@ant-design\react-native\node_modules node_modules

Because the node window display Error so it makes the app display the 500 error too:
![This is an image](https://files.gitter.im/58ecaa31d73408ce4f57939e/kd2R/image.png)

### What is expected?

We should not see this error and it should display a checkbox

### What is actually happening?

The node window display module

error: Error: Unable to resolve module classnames from C:\Users\hoa.nguyenlexuan\Desktop\vaultbox\Vaultbox-dev-Mobile\vaultbox_mobile\node_modules\@ant-design\react-native\lib\tag\index.js: classnames could not be found within the project or in these directories: node_modules\@ant-design\react-native\node_modules node_modules


Because the node window display Error so it makes the app display the 500 error too:
![This is an image](https://files.gitter.im/58ecaa31d73408ce4f57939e/kd2R/image.png)

| Environment | Info |
| --- | --- |
| antd | 5.0.0 |
| React | React: 17.0.2 /react native: 0.68.1  |
| System | Android 10.0.0 (google api) |
| Browser | Android emulator - Pixel 5  |

<!-- generated by ant-design-issue-helper. DO NOT REMOVE -->
1uokun commented 2 years ago
npm install classnames rc-util

Duplicate of #1228

student1060632fpt commented 2 years ago
npm install classnames rc-util fbjs

Duplicate of #1228

Thank a lot @1uokun, It's really work for me. I use yarn instead of npm

yarn add classnames rc-util fbjs
1uokun commented 1 year ago

fixed in 5.0.1