Skip to content

markmctamney/react-native-web-ts-types

Repository files navigation

Getting Started

To install react-native-web-ts-types, run

npm i https://github.com/gtechnologies/react-native-web-ts-types.git

or

yarn add https://github.com/gtechnologies/react-native-web-ts-types.git

It will automatically be saved as @types/react-native-web and allow you to use TypeScript with react-native-web.

Why is this package needed?

react-native-web is a powerful front-end development library that enables you to use the interface for React Native components when developing on web. Thus far, react-native-web has used Facebook's flow instead of TypeScript for adding typing to JavaScript components. For developers using TypeScript, this can be problematic and cause compiling issues. Our team has built react-native-web-ts-types to make developing with react-native-web easier for teams using TypeScript.

How To Convert From Flow To TypeScript

Generally, most files written in Flow can be converted to TypeScript using Khan Academy's flow-to-ts library.

https://flow-to-ts.netlify.app/ https://github.com/Khan/flow-to-ts

Flow Type to TypeScript Type

type ViewStyle = $PropertyType<ViewProps, 'style'>; -> type ViewStyle = ViewProps['style'];

// TODO

  • Filter for "forwardPropsList"

Convert UI Components

  • FlatList

Convert Other Files

Known Issues

Questions

  • Should we convert all React.Component to React.PureComponent or React.FunctionComponent?

Discussion

About

Type definitions for React Native Web

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published