'Warning: Functions are not valid as a React child. (React-native )
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.
Solution 1:[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 a newer version (>= 0.9.2, preferably use the latest stable version).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
