-
Notifications
You must be signed in to change notification settings - Fork 477
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
renderButtonText renders '[object Object]' if there is a call to setState in onSelect or renderButtonText functions #139
Comments
it seems any call to setState is breaking the renderButtonText. [object Object] looks very broken. |
@Culzean the same here, if I use setState it goes in some endless loop and I receive maximum call stack size exceeded error. |
Having the same issue as well, and I am not using any <ModalDropdown
ref={self => { this.accountPicker = self }}
defaultValue={i18n.t('ui.inputs.account_picker.placeholder')}
options={accounts.data}
onSelect={({ address }) => this.updateTxField({ from: address })}
renderRow={({ title }) => <Text>{title}</Text>}
renderButtonText={({ title }) => title}
style={style.dropdownContainer}
textStyle={style.dropdownText}
dropdownStyle={style.dropdownStyle}
/> In my example, The results are as follows (image 1 is during selection, 2 is after the option is clicked): I tried reverting back to version 0.5.0 to see what would happen and in that, |
I tracked it down. The error occurs in componentWillReceiveProps(nextProps) {
let {buttonText, selectedIndex} = this.state;
const {defaultIndex, defaultValue, options} = nextProps;
buttonText = this._nextValue == null ? buttonText : this._nextValue.toString(); //<<< here
selectedIndex = this._nextIndex == null ? selectedIndex : this._nextIndex;
if (selectedIndex < 0) {
selectedIndex = defaultIndex;
if (selectedIndex < 0) {
buttonText = defaultValue;
}
}
this._nextValue = null;
this._nextIndex = null;
this.setState({
loading: !options,
buttonText,
selectedIndex
});
} |
I submitted a PR -> #142 Feel free to use |
Fixed in v0.6.2 #146 |
Just testing out the update now. Issue resolved. Thanks! |
I have version 0.6.1 and am using a slightly more complex data structure.
If there is a call to setState for both of these functions then the dropdown text renders as [object Object]. If I remove the call then the dropdown renders the ssid strings as expected.
The text was updated successfully, but these errors were encountered: