danilowoz/react-native-styl

Type-safe to `as` prop

danilowoz opened this issue ยท 2 comments

Currently, when the as prop is used in a new component, the props from the new component are no type-safe. Example:

import styl from "react-native-styl"
import { Text, TouchableOpacity } from "react-native"

const Base = styl(Text)({
  padding: 16
})

// onPress is not typed correctly
<Base as={TouchableOpacity} onPress={() => null}>
  <Text>TouchableOpacity</Text>
</Base>

The goal here is when the component receives a component through as, the type needs to infer and get the props from the new component, and pass it to the render.

๐ŸŽ‰ This issue has been resolved in version 1.2.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€