Search code examples
react-nativereact-native-ui-kitten

React native : Component nothing was returned from the render (UiKitten)


I have this problem, my code works well but if I put an Accessory Right or Left I get the error Nothing was returned from the render. On other screen it works perfectly but on this screen it's impossible. There are some things that i really don't understand with UIKItten. Thank you for your help.

  userChange = () =>  {
    this.state.navigation.navigate('Login', {noAutoConnect : true});
  }

  Disconnect = () => {
    <TopNavigationAction icon={Quit} onPress={this.userChange}/>
  }
  
  render() {    
    return (
        <>
          <TopNavigation style={{ borderWidth: 1 }} title='Acceuil' alignment='center' accessoryLeft = {this.Disconnect}  />
            <View style = {style.lay}>
              <Button size = "giant" onPress = {this.navigateArticles} status = "danger"><Text>Accéder à mes Pdf</Text></Button>
            </View>
       </>
    );
  }

Solution

  • Add return in Disconnect function.

    Disconnect = () => {
        return <TopNavigationAction icon={Quit} onPress={this.userChange}/>
    }