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

点击事件无法改变选中状态 #71

Open
banlu opened this issue Jul 13, 2018 · 5 comments
Open

点击事件无法改变选中状态 #71

banlu opened this issue Jul 13, 2018 · 5 comments

Comments

@banlu
Copy link

banlu commented Jul 13, 2018

点击事件函数可以正常触发,但是选中状态的图片不会改变,一直显示初始的状态。
看到其他问题,也有人提这个问题,希望能解决一下。

@lhp--
Copy link

lhp-- commented Jul 18, 2018

+1

@narcissus571
Copy link

@banlu 我是把 源代码中,52行的getDerivedStateFromProps方法,注释掉,就可以了
初学 react-native 不知道 这个方法是什么意思

@banlu
Copy link
Author

banlu commented Jul 27, 2018

@narcissus571 这个方法是能解决这个问题,

@iwenchao
Copy link

看了源码,需要在CheckBox添加一个属性 isChecked; 所以 <CheckBox
isChecked={itemData.checked}
...
/>
这样写就可以了

点击事件函数可以正常触发,但是选中状态的图片不会改变,一直显示初始的状态。
看到其他问题,也有人提这个问题,希望能解决一下。

看了源码,需要在CheckBox添加一个属性 isChecked; 所以 <CheckBox
isChecked={itemData.checked}
...
/>
这样写就可以了

@C19911211
Copy link

也遇到这个问题,很烦

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

5 participants