如何在 LinearGradient 中传递 children?

How to pass a children in a LinearGradient?

那是我的代码,基本上我正在研究 React Native 并在尝试在 LinearGradient.

中传递 children 时出错
import React, { ReactNode } from "react";
import { LinearGradient } from "expo-linear-gradient"

import { styles } from "./styles"
import { theme } from "../../global/styles/theme"

type Props = {
  children: ReactNode
}

export function Background({ children }: Props) {
  const {secondary80, secondary100} = theme.colors;

  return (
    <LinearGradient
      style={styles.container}
      colors={[secondary80, secondary100]}
    >
     {children}
    </LinearGradient>
  )
}

完整的错误是:

(parameter) children: React.ReactNode<br>
No overload matches this call.
  Overload 1 of 2, '(props: LinearGradientProps | Readonly<LinearGradientProps>): LinearGradient', gave the following error.<br>
    Type 'ReactNode' is not assignable to type '((boolean | ReactChild | ReactFragment | ReactPortal) & (boolean | ReactChild | ReactFragment | ReactPortal)) | null | undefined'.<br>
      Type '{}' is not assignable to type '((boolean | ReactChild | ReactFragment | ReactPortal) & (boolean | ReactChild | ReactFragment | ReactPortal)) | null | undefined'.<br>
  Overload 2 of 2, '(props: LinearGradientProps, context: any): LinearGradient', gave the following error.<br>
    Type 'ReactNode' is not assignable to type '((boolean | ReactChild | ReactFragment | ReactPortal) & (boolean | ReactChild | ReactFragment | ReactPortal)) | null | undefined'.ts(2769)<br>
index.d.ts(2320, 5): The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<LinearGradient> & Readonly<LinearGradientProps> & Readonly<...>'<br>
index.d.ts(2320, 5): The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<LinearGradient> & Readonly<LinearGradientProps> & Readonly<...>'

对于 LinearGradient 的道具

<LinearGradient
 style={styles.container}
 colors={[secondary80, secondary100]}
 children={children}>

</LinearGradient>

对于子组件

<LinearGradient
 style={styles.container}
 colors={[secondary80, secondary100]}>
  <children />
</LinearGradient>