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

Calendar 在2.0.16上无法同时兼容h5和小程序,必须使用不同的,@nutui/nutui-react或者 @nutui/nutui-react-taro #1407

Closed
byMoWen opened this issue Sep 7, 2023 · 2 comments
Assignees
Labels
to be closed 未提供最小化可复现 demo 且长期无进展的 issue

Comments

@byMoWen
Copy link

byMoWen commented Sep 7, 2023

NutUI React 包名

@nutui/nutui-react-taro

NutUI React 版本号

2.0.16

平台

h5, weapp

重现链接

官网例子

重现步骤

官网的例子,
import React, { useState } from 'react'
import { Calendar } from '@nutui/nutui-react-taro'
// import { Calendar } from '@nutui/nutui-react'
const App = () => {
const [date2, setDate2] = useState('2020-07-08')
const setChooseValue2 = param => {
setDate2(param[3])
}

return (
<>
<div className='test-calendar-wrapper' style={{ display: 'flex', width: '100%', height: '613px', overflow: 'hidden' }}>


</>
)
}
export default App
build:h5 build:weapp 用同一个引用使用Calendar ,比如@nutui/nutui-react-taro h5会出现Uncaught TypeError: xe[(n + 1)] is undefined Uncaught TypeError: xe[(n + 1)] is undefined
monthsViewScroll https://nutui.jd.com/taro/react/2x/demo/chunk/5870.js:2
handler https://nutui.jd.com/taro/react/2x/demo/chunk/5870.js:2
或者使用 @nutui/nutui-react weapp会出现 Cannot read property 'useContext' of null

期望的结果是什么?

只用其中一种可以同时发布在小程序或者h5,不需要判断环境

实际的结果是什么?

目前使用的无法做到

环境信息

"@nutui/nutui-react": "^2.0.16",
"@nutui/nutui-react-taro": "^2.0.16",
"@tarojs/taro": "3.6.13",
"@tarojs/react": "3.6.13",

其他补充信息

node 20.6.0

@xiaoyatong
Copy link
Collaborator

在taro环境下 就用 nutui-react-taro 就好了

@byMoWen
Copy link
Author

byMoWen commented Sep 8, 2023

问题是我用 nutui-react-taro版本的 发布h5 任何需要滚动的日历都会有问题 Uncaught TypeError: xe[(n + 1)] is undefined 例子如 https://nutui.jd.com/taro/react/2x/#/zh-CN/component/calendar
我以为我的其他组件影响,又taro init了一个新的项目 模板是react-NutUI(使用 NutUI React 的模板),只有一个Calendar 日历 @nutui/nutui-react-taro下 ,初步判断 h5 编译 只要不使用onConfirm就不会出现 Uncaught TypeError: xe[(n + 1)] ,小程序没问题

@eiinu eiinu added the to be closed 未提供最小化可复现 demo 且长期无进展的 issue label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to be closed 未提供最小化可复现 demo 且长期无进展的 issue
Projects
None yet
Development

No branches or pull requests

3 participants