Skip to content

Encounters a runtime error while using renderRow #153

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

Open
afshin-hoseini opened this issue Mar 31, 2018 · 1 comment
Open

Encounters a runtime error while using renderRow #153

afshin-hoseini opened this issue Mar 31, 2018 · 1 comment

Comments

@afshin-hoseini
Copy link

afshin-hoseini commented Mar 31, 2018

The below snippet faces runtime error, while, it works just fine without renderRow prop.

<Dropdown 
                disabled = {this.state.isLoadingAgents}
                options = {["a","b"]}
                dropdownStyle = {[Styles.agentsDropDown]}
                adjustFrame = {style => {

                    style.width = this.agentDropdownFrameWidth
                    return style
                }}
                renderRow = {this.renderAgentRow.bind(this)}
                >

                <View style={Styles.agentSelectionBox} 
                 onLayout={(event) => this.agentDropdownFrameWidth = event.nativeEvent.layout.width}>

                    {this.state.isLoadingAgents ?
                    
                        <ActivityIndicator color = '#12125A'/> :
                        <Image style={Styles.compassImage}  source = {require('res/Images/Compass/compass.png')}/>
                    }
                    
                    <Text style = {Styles.selectAgentBox_title} > {I18n.t('SelectCity_variantSelection')} </Text>

                </View>

            </Dropdown>

The renderer method

renderAgentRow(item, index, selected) {

    return(<TouchableOpacity> <Text>{item}</Text> </TouchableOpacity>);
}

Error

Raw text cannot be used outside of a <Text> tag. Not rendering string: ' '
@sohobloo
Copy link
Owner

sohobloo commented Apr 2, 2018

Please remove the spaces within the jsx return

return(<TouchableOpacity><Text>{item}</Text></TouchableOpacity>);

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

2 participants