question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Property 'children' does not exist on type 'IntrinsicAttributes & blahbah'

See original GitHub issue
"@shopify/restyle": "^1.4.0",
"@shopify/restyle": "^1.4.0",
"typescript": "~4.0.0"

use the following code to generate a <Button> component

const theme = createTheme({
  colors: {
    mainBackground: "#F0F2F3",
    cardPrimaryBackground: "#5A31F4",
  },
});

type Theme = typeof theme

export const Button = createBox<Theme, TouchableOpacityProps>(TouchableOpacity);

When you use it directly, it will give you a type error: image

It will be fixed if we change the declaration to:

export const Button = createBox<
  Theme,
  TouchableOpacityProps & { children?: React.ReactNode }
>(TouchableOpacity);

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:13
  • Comments:5

github_iconTop GitHub Comments

4reactions
edgarypcommented, Feb 8, 2022

I am running into the same issue with createRestyleComponent too. Worked around with using PropsWithChildren from React.

import React, { FC, PropsWithChildren } from "react";

type CardProps = PropsWithChildren<
  SpacingProps<Theme> & VariantProps<Theme, "cardVariants">
>;

const Card = createRestyleComponent<CardProps, Theme>([
  spacing,
  createVariant({ themeKey: "cardVariants" }),
]);

type ButtonProps = {
  onPress: () => void;
  text: string;
};

export const Button: FC<ButtonProps> = ({ onPress, text }) => {
  return (
    <TouchableOpacity onPress={onPress}>
      <Card>
        <Text>{text}.....</Text>
      </Card>
    </TouchableOpacity>
  );
};

2reactions
seyaobeycommented, Jan 23, 2021

Same problem. This library is fantastic, the best library I’ve found for react-native styling. But there is not enough documentation. I’m fighting with the same errors and there is just not resources or examples to help

Read more comments on GitHub >

github_iconTop Results From Across the Web

ts(2322) Property children does not exist on type 'Intrinsic ...
I'm getting the following error while trying to create a multimap with 'date' as the key and then iterate through the multimap which...
Read more >
React.js: Property 'children' does not exist on type 'X'
The React.js error "Property 'children' does not exist on type" occurs when we try access the children property in a component for which...
Read more >
React 18 - Property 'children' does not exist fix [2022] - YouTube
... to React 18 and tried to follow tutorials from myself or others, you may run into the error: Property ' children '...
Read more >
property 'children' does not exist on type 'intrinsicattributes
The "property 'children' does not exist on type 'intrinsicattributes" error is caused when you try to access the children property of a component...
Read more >
Removal of implicit children - solverfox.dev
Explainer why we intend to get rid of implicit children in `@types/react` ... Property 'typ' does not exist on type // 'IntrinsicAttributes &...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found