ant-design / ant-design-mobile-rn

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

Attempted import error: 'ActionSheetIOS' is not exported from 'react-native' #1208

Closed alphazhe closed 2 years ago

alphazhe commented 2 years ago

Reproduction link

https://github.com/alphazhe/AntDesignTest

Steps to reproduce

Execute these commands one by one, once https://github.com/alphazhe/AntDesignTest repo is cloned

  1. git checkout master
  2. yarn
  3. yarn web

What is expected?

ActionSheetIOS error should not come if the project is run on web using react-native-web.

What is actually happening?

Even if we use single component from ant design on web, it does give ActionSheetIOS error. I have used only Button from ant, but it still gives the same error.

Environment Info
antd 4.2.0
React 0.66.3
System macOS Monterey 12.0.1
Browser Chrome

Please provide either fix or workaround to solve react-native-web related issues.

1uokun commented 2 years ago

We do not support react-native-web at the moment

alphazhe commented 2 years ago

@1uokun Is there any workaround for this? Or can we use ant-design-mobile in react native project for mobile app and web app?

1uokun commented 2 years ago

Import Component on demand loading(🔗按需加载) And do not import component who not support react-native-web

- import {Button} from '@ant-design/react-native';
   ↓    ↓    ↓    ↓    ↓    
+ import Button from '@ant-design/react-native/lib/button';