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.

@expo/html types errors

See original GitHub issue

I’m weirdly getting this error again. Seems like something changed with React’s types, since I’m getting this after upgrading to Expo SDK40:

Type '{ children: string; }' is not assignable to type '(IntrinsicAttributes & Pick<StyledProps<TextProps>, "style" | "sx" | "themeKey" | "variant" | "variants" | "as" | "webContainerSx"> & Pick<...> & WebTextProps & RefAttributes<...>) | (IntrinsicAttributes & ... 4 more ... & RefAttributes<...>)'.
  Type '{ children: string; }' is missing the following properties from type 'Pick<TextProps & ClassAttributes<typeof Text>, "onLayout" | "testID" | "nativeID" | "accessible" | "accessibilityActions" | "accessibilityLabel" | ... 29 more ... | "accessibilityTraits">': accessibilityComponentType, accessibilityTraits

56       <H3>{title}</H3>

I think we need to add a { children?: React.ReactNode } to the return type of createThemedComponent…not sure. Will investigate this more. Using dripsy@1.4.6

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

0reactions
nandorojocommented, Sep 27, 2021

Okay, I identified the issue.

For some reason, the react native TextProps are now requiring two props: accessibilityComponentType & accessibilityTraits. No idea why. I tried downgrading versions of @types/react-native to no avail.

However, with some declaration merging, I was able to solve it by just making them optional.

All you need to do is put this TS file anywhere in your app:

// dripsy-hack.d.ts
import 'react-native'

declare module 'react-native' {
  // fix HTML elements 
  interface TextProps {
    accessibilityComponentType?: string
    accessibilityTraits?: string
  }
  // pressable type support
  interface PressableStateCallbackType {
    hovered?: boolean
    focused?: boolean
  }
  // transition support in view props
  interface ViewStyle {
    transitionProperty?: string
    transitionDuration?: string
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Dealing with global errors in React-Native Expo as simple as ...
The ErrorUtils is a global property in React-Native projects, you can use it directly. First, store the default error handler: const ...
Read more >
Enforcing Consistent Code in Expo React Native Projects
Enforcing Consistent and Error Free Code in an Expo React Native Project with TypeScript. Improve your team's code quality and efficiency by ...
Read more >
after updating expo: Element type is invalid: expected a string ...
After I updated my Expo SDK from 39 to 42, I got following error when trying to launch the app: Error: Element type...
Read more >
Configuration with app.json / app.config.js
Learn about what is Expo config and how you can dynamically use it by customizing it. ... You can think of this as...
Read more >
expo-web-browser - npm
expo -web-browser. TypeScript icon, indicating that this package has built-in type declarations · Readme · Code Beta · 1 Dependency · 102 Dependents ......
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