Warning: Functions are not valid as a React child. (React-native )

走远了吗. 提交于 2020-12-12 09:16:33

问题


I am receiving the error: Warning: Functions are not valid as a React child.

I am writing a React Native application.

interface RegisterScreenProps {
  navigation: NavigationContainerRef;
}

const RegisterScreen: FunctionComponent<RegisterScreenProps> = ({
  navigation,
}: RegisterScreenProps) => {
  const { container, headerLogo, headerTitle, body } = styles;

  return (
    <SafeAreaView style={{ flex: 1 }}>
      <KeyboardAwareScrollView style={styles.container}>
        <View>
        <TextInput value={'afasfasdfdsfssddfsdfsffasf'} placeholder={'My Input'} />
        </View>
        
      </KeyboardAwareScrollView>
    </SafeAreaView>
  );
};

export default RegisterScreen;

I have tried many solutions but did not get success. When I remove KeyboardAwareScrollView this code works fine. i need KeyboardAwareScrollView for TextInput.


回答1:


This is an issue from react-native-keyboard-aware-scroll-view, fixed in this commit .

You need to upgrade your react-native-keyboard-aware-scroll-view version in package.json to 0.9.2



来源:https://stackoverflow.com/questions/63137676/warning-functions-are-not-valid-as-a-react-child-react-native

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!