问题
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