RN Exception: Warning: Functions are not valid as a React child. This may happen if you return a ...

3241 단어

이상

ReactNativeJS: Warning: Functions are not valid as a React child. This may happen if you return a Component instead of  from render. Or maybe you meant to call this function rather than return it.
        in RCTView (at View.js:60)
        in View (at createAnimatedComponent.js:154)
        in AnimatedComponent (at Header.js:443)
        in RCTView (at View.js:60)
        in View (at Header.js:488)
        in RCTView (at View.js:60)
        in View (at Header.js:624)
        in RCTView (at View.js:60)
        in View (at createAnimatedComponent.js:154)
        in AnimatedComponent (at index.js:134)
        in SafeView (at withOrientation.js:54)
        in withOrientation (at Header.js:622)
        in RCTView (at View.js:60)
        in View (at createAnimatedComponent.js:154)
        in AnimatedComponent (at Header.js:611)
        in Header (at withOrientation.js:30)
        in withOrientation (at StackViewLayout.js:154)
        in RCTView (at View.js:60)
        in View (at StackViewLayout.js:780)
        in RCTView (at View.js:60)
        in View (at createAnimatedComponent.js:154)
        in AnimatedComponent (at StackViewCard.js:69)
        in RCTView (at View.js:60)
        in View (at createAnimatedComponent.js:154)
        in AnimatedComponent (at screens.native.js:58)
        in Screen (at StackViewCard.js:57)
        in Card (at createPointerEventsContainer.js:27)
        in Container (at StackViewLayout.js:858)
        in RCTView (at View.js:60)
        in View (at screens.native.js:83)
        in ScreenContainer (at StackViewLayout.js:311)
        in RCTView (at View.js:60)
        in View (at createAnimatedComponent.js:154)
        in AnimatedComponent (at StackViewLayout.js:307)
        in Handler (at StackViewLayout.js:300)
        in StackViewLayout (at withOrientation.js:30)
        in withOrientation (at StackView.js:79)
        in RCTView (at View.js:60)
        in View (at Transitioner.js:215)
        in Transitioner (at StackView.js:22)
        in StackView (created by Navigator)
        in Navigator (at createKeyboardAwareNavigator.js:12)
        in KeyboardAwareNavigator (at createAppContainer.js:388)
        in NavigationContainer (at rootPage.js:84)
        in RootPage (at drawPage.js:112)
        in DrawPage (at TopView.js:202)
        in RCTView (at View.js:60)
        in View (at createAnimatedComponent.js:154)
        in AnimatedComponent (at TopView.js:164)
        in RCTView (at View.js:60)
        in View (at TopView.js:163)
        in TopView (at TopView.js:201)
        in RootElement (at renderApplication.js:33)
        in RCTView (at View.js:60)
        in View (at AppContainer.js:102)
        in RCTView (at View.js:60)
        in View (at AppContainer.js:122)
        in AppContainer (at renderApplication.js:32)

해결 방법

  • 문제 코드

  • headerRight 매개 변수의 값은 방법이 아닌 구성 요소여야 하기 때문에 경고가 표시됩니다.
    static navigationOptions = () => ({
        title: ' ',
        headerRight: () => 
      });
    
  • 해결

  • 상술한 코드를
      static navigationOptions = () => ({
        title: ' ',
        headerRight: 
      });
    

    좋은 웹페이지 즐겨찾기