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

render props 无法传递函数(引用类型) #5013

Closed
youngluo opened this issue Dec 5, 2019 · 7 comments
Closed

render props 无法传递函数(引用类型) #5013

youngluo opened this issue Dec 5, 2019 · 7 comments
Assignees

Comments

@youngluo
Copy link

youngluo commented Dec 5, 2019

问题描述

render props 无法传递函数,引用类型貌似都不稳定,极少数情况下重复打包会表现正常

// 父组件
const onCancel = () => {
   setVisible(false)
}

<View className={styles.content}>
   {props.renderChildren(onCancel)}
</View>

// 子组件
<FilterMask
    title={_.get(_.find(typeTagList, ['value', type]), 'label')!}
    renderChildren={(onCancel) => (
    <TagList
       onChange={onTypeChange.bind(null, onCancel)}
       dataSource={typeTagList}
       value={[type]}
       mode='radio'
       selectable
      />)}
 />

const onTypeChange = (onCancel, v) => {
  console.log('onCancel', onCancel)
  onCancel && onCancel()
  setType(v)
}

期望行为

能正常传递函数并调用

报错信息

正常情况
企业微信截图_15755389212834

不正常情况
企业微信截图_15755376777220

系统信息

Taro CLI 1.3.27 environment info:
System:
OS: Windows 10
Binaries:
Node: 10.16.0 - E:\intsall\nodejs\node.EXE
Yarn: 1.17.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.9.0 - E:\intsall\nodejs\npm.CMD

@taro-bot
Copy link

taro-bot bot commented Dec 5, 2019

CC @Chen-jj

@taro-bot
Copy link

taro-bot bot commented Dec 5, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@youngluo
Copy link
Author

youngluo commented Dec 5, 2019

@luckyadam

@shenghanqin
Copy link
Collaborator

@youngluo 你的代码示例,俺看不懂父子级的关系,好像是错的。

@taro-bot
Copy link

taro-bot bot commented Dec 6, 2019

Hello~

您的问题所提供的信息不足,我们无法定位到具体的问题。如果有空的话还请拔冗提供更具体的信息,否则这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

@taro-bot
Copy link

taro-bot bot commented Dec 26, 2019

CC @yuche

@Chen-jj Chen-jj reopened this Dec 27, 2019
@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 2, 2020

Taro3 应该没有这个问题了。

@Chen-jj Chen-jj closed this as completed Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants