React Native version 0.71 is officially released, which is a feature-rich version, including: default TypeScript, Flexbox Gap, restored PropTypes and new schema updates, etc.
Default TypeScript
Starting with version 0.71, when you create a new React Native application through the React Native CLI, you will get a TypeScript application by default.
We also directly from react-native
The package provides built-in, more accurate TypeScript declarations.This means you will no longer need @types/react-native
and the type will be updated in sync with the React Native version.
Simplify layout with Flexbox gaps
With React Native, you can flexibly layout components on different screen sizes using Flexbox. Browsers already support the Flexbox gap, rowGap, and columnGap properties, which allow you to specify the amount of space between all items in a Flexbox.
These properties have been required in React Native for a long time, and version 0.71 added initial support for gaps defined using pixel values. In future versions, we will add support for more numeric values, such as percentages.
Web-inspired accessibility, styling, and event attributes
This release includes some new properties inspired by web standards to make React Native’s API consistent across many platforms. These new attributes are purely incremental, so there are no anticipated migrations or behavior changes for equivalent accessibility, behavior, or style attributes.
For any new property alias introduced, if an existing property has a different name and both are specified, the new alias property value will take precedence.For example, this version for the image component’s source
added a src
Property aliases to match the src
properties remain the same.If provided at the same time src
and source
will use the new src
Attributes.
Restoring PropTypes
React Native property types like ViewPropTypes
and Text.propTypes
, which have been deprecated in version 0.66, accessing them will output a deprecation warning. When they were removed in version 0.68, many developers started encountering errors when upgrading to the latest version of React Native.
So in this release, we’ve re-added React Native’s PropTypes to make it easier for people to upgrade and migrate their code and avoid using them. In version 0.71,deprecated-react-native-prop-types
The package has also been updated with all properties. In the future, we plan to continue the deprecation and remove property types again.
Improvements to the developer experience
React DevTools
This release brings two popular React DevTools features from the web to React Native.
“Click to inspect” is an option in the upper left corner of React Dev Tools that allows you to click on an item in the app to inspect it in Dev Tools, similar to Chrome’s element inspector.
Component highlighting will highlight elements you select in DevTools in your app, so you can see which React components correspond to which elements on the screen.
new architecture
This release brings many improvements to the experimental new architecture experience based on user feedback and reports collected so far.
- Improved build times: The new release mode uses Maven Central, which allows us to drastically reduce build times on Android, fixes many build issues on Windows, and provides a more seamless experience for the new architecture.
- Write less C++ code: you can now enable the new architecture without adding any C++ code in your app, all C++ code and CMake files in CLI app templates have been cleaned up
- Better encapsulation of iOS app settings: On iOS, a similar approach to Android is taken and most of the logic for setting up the new architecture is encapsulated in
RCTAppDelegate
class, which will simplify future upgrades - Better iOS dependency management: For library maintainers, we’ve added a new
install_module_dependencies
function, in yourpodspec
package, which will install all required dependencies for the new architecture. - Bug fixes and better IDE support: Fixed several bugs and issues reported by users in the new architecture working group
For more details, please view: https://reactnative.dev/blog/2023/01/12/version-071
#React #Native #released #TypeScript #default #restores #PropTypes #News Fast Delivery