0.13
This release includes many significant changes and improvements.
- Modern React: implements components using function components and hooks. It removes use of various legacy React features such as legacy context and
create-react-class
. These changes mean better support for Concurrent Mode, Fast Refresh, and interaction handling. - Gesture Responder System: this has be rewritten from scratch in user space. Dozens of bugs have been fixed and the system is heavily unit tested; it's now the most accurate and well integrated implementation of any platform.
- React Alternatives: this release removes the use of unstable React DOM APIs. React Native for Web can now be used with Preact and other libraries that are API compatible with React. However, it should be noted that benchmark rendering of 0.13 with React DOM is a lot faster than Preact.
Breaking changes
- The Responder System has been rewritten. This should not be a breaking change (and comes with many bug fixes), but since the system is implemented in user-space rather than React, it may encounter differences in timings relative to the ReactDOM events.
- The
onPress
callback on Touchables is now backed by nativeclick
events and will be called in almost every situation a nativeclick
event is called. TheonPress
prop ofTouchable*
components now receives aSyntheticMouseEvent
not aSyntheticResponderEvent
. It may be fired without a precedingonPressIn
. - All the components are implemented as function components, so using
findNodeHandle
to get a reference to the component's underlying host node will not work. Useref
instead. ThefindNodeHandle
andfindDOMNode
APIs are discouraged and are not safe with function components or concurrent mode. - The
forwardedRef
props have been removed. Theref
on a component will now return a ref to the host node, which has the imperative methods attached to it. - The
hitSlop
prop has been removed. This caused incorrect hit targets for mouse interactions. The browser's built-in touch hitslop will be relied on instead. - The prop types of each component are now explicit. Unknown props will not be forwarded to the underlying React DOM component.
- Forwarding of
data-*
props is no longer supported. UsedataSet
instead. For example,dataSet={{ someName: 1 }}
. - The
onLayout
prop now requires aResizeObserver
polyfill to work, and does not fallback to windowresize
events. - Removed React Native APIs that have been removed or deprecated:
TabBarIOS
,TimePickerAndroid
- Removed support for HTML microdata props. Microdata has been removed from the HTML spec.
- Removed the
accessibilityRelationship
prop. This prop was not added to React Native. Continue usingaria-*
props for now.
New features
- Added
View
support foraccessibilityValue
. - Added the
Pressable
component. - Add the
Appearance
API anduseColorScheme
hook.
Fixes
- The active touch responder will now be terminated when the body scrolls, context menu appears, etc.
- Performance improvements for Touchables.
TheonPress
event can now be used topreventDefault
the native click behavior (this is no longer done automatically) - Fixes
Image
support for variable resolution images (requires bundler integration). - Fixes
TextInput
support foronContentSizeChange
to allow auto-grow textareas. - Fixes the correctness of setting styles using
ref.setNativeProps
. Recommend avoiding this API as it is expected to be deprecated in React Native.