Releases: necolas/react-native-web
0.21.2
What's Changed
- Modal: Significantly improve animation by @qwertychouskie in #2805
- Fix memory leak in AnimatedProps constructor by @c-miles in #2809
- feat(accessibility): add inert to forwardedProps by @theonetheycallneo in #2773
New Contributors
- @qwertychouskie made their first contribution in #2805
- @c-miles made their first contribution in #2809
- @theonetheycallneo made their first contribution in #2773
Full Changelog: 0.21.1...0.21.2
0.21.1
Full Changelog: 0.21.0...0.21.1
0.21.0
These are fixes but also potentially breaking changes.
- Correctly propagate
pointer-events: autoto children of elements usingpointerEvents: 'box-none'. - Update
createPortalimport from react-dom
Full Changelog: 0.20.0...0.21.0
0.20
0.19
Best compatibility: react-native@>=0.71
React 18 support
- [change] React 18
createRootsupport. - [change] Update
Animatedto support React 18, including newAnimatedColornode. - [change] Update
ScrollViewto Class component for React 18 support.
New features
- [add] Map
'button'and'paragraph'role to equivalent semantic HTML elements. - [add] Add support for
aria-*props. - [add] Add support for
roleprop. - [add] Add support for
idprop. - [add] Add support for
tabIndexprop (only values0and-1). - [add] Support for
PointerEventprops. - [add] Add support for
pointerEventsstyle. - [add] Add support for
userSelectstyle. - [add] Add polyfilled support for W3C logical styles (e.g.,
insetInline.) - [add] Add
<Image>support fortintColorprop. - [add] Add
<TextInput>support forenterKeyHintprop. - [add] Add
<TextInput>support forinputModeprop. - [add] Add
<TextInput>support forreadOnlyprop. - [add] Add
<TextInput>support forrowsprop.
Deprecations
- [change] Deprecate
Touchable*components. UsePressable. - [change] Deprecate
Buttoncomponent. UsePressable. - [change] Deprecate
StyleSheet.compose(). Use style array syntax. - [change] Deprecate
accessibility*props. Usearia-*androleprops. - [change] Deprecate
nativeIdprop. Useidprop. - [change] Deprecate
focusableprops. UsetabIndexprop. - [change] Deprecate
pointerEventsprop. UsepointerEventsstyle. - [change] Deprecate
selectableprop. UseuserSelectstyle. - [change] Deprecate
fontVariantstyle array values. Use space-separated string values. - [change] Deprecate
textAlignVerticalstyle. UseverticalAlignstyle. - [change] Deprecate
transformstyle array values. Use space-separated string functions. - [change] Deprecate non-standard logical styles, e.g., 'marginStart'.
- [change] Deprecate
<Image>styleresizeMode. UseresizeModeprop. - [change] Deprecate
<Image>styletintColor. UsetintColorprop. - [change] Deprecate
<TextInput>propkeyboardType. UseinputModeprop. - [change] Deprecate
<TextInput>propreturnKeyType. UseenterKeyHintprop. - [change] Deprecate
<TextInput>propeditable. UsereadOnlyprop. - [change] Deprecate
<TextInput>propnumberOfLines. Userowsprop. - [change] Deprecate
BackHandlerAPI.
Breaking changes
- [change] Remove previously deprecated Android/iOS platform-specific exports.
- [change] Remove previously deprecated
setNativePropsAPI. - [change] Remove previously deprecated
AppState.removeListenerAPI. - [change]
<Text>isposition:relativeby default. - [change] Add task queue for
InteractionManager.
Fixes
- [fix]
Animatednow works with compiled styles. - [fix] Text inheritance of
textAlign.
0.18
Breaking changes
- Browser support has been reduced. Changes as follows: Safari 10.1+, Edge (Chromium), no IE, no legacy Android browser.
- Styles are inserted on module eval, not component render. This is needed to account for changes to rendering in React 18.
- Style sheets rendered on the server will now include styles from all the eval-ed modules, rather than only the styles produced by the initial render.
StyleSheet.create()is now the identify function, returning the input style objects. Previously, it replaced styles with numeric ids. This improves compatibility with React Native, but accessing the returned style objects at runtime is still not recommended as it can prevent static extraction to CSS. (#2068)StyleSheet.getSheet()can be used on the server to retrieve the current style sheet as a CSS string. (#2196)I18nManageris now a mock API included only for compatibility with React Native. The ability to flip left/right properties or values has now been removed entirely (use start/end instead). See below for new localization APIs.- Inline styles are no longer automatically vendor-prefixed. This improves inline style performance and discourages use of inline styles. This should have little effect in practice if your app is predominantly using
StyleSheet.create(). - The deprecated
accessible,accessibilityState, andaccessibilityValueprops have been removed. - The
:focus-visiblepolyfill has been removed, as by default modern browsers no longer show focus rings for pointer interactions. - VirtualizedList, FlatList, and SectionList vendor components have been updated to match latest React Native. (#2241) Thanks to @DavidRieman.
- The legacy jest preset and snapshot serializer has been removed from the npm package.
- The
unstable_createElementAPI has changed. Children are no longer accepted as the 3rd argument, they must be included in the props as the 2nd argument. The 3rd argument is now an options object with a field to set the expected writing direction ({ writingDirection }).
New features
- Localized LTR/RTL layouts can now be nesting to arbitrary depths simply by setting the
dirorlangprop on a component. By default, layouts are rendering RTL. To render RTL you must setdir="rtl"on an outer element rendered by React. - Localized LTR/RTL layouts can be switched dynamically at runtime.
useLocaleContextis a new export API. Use it to query a component's locale and writing direction context for fine-grained control over localized layout.- Rendering into multiple windows and shadow roots in now supported. (#1517, #2138)
- Extraction to static CSS and consumption of external CSS is now possible but not yet recommended. The StyleSheet runtime can consume any styles that match an expected format, but
StyleSheet.flattencannot work with extracted styles. (See below for more details.)
Fixes
- Fixes static and dynamic shortform / longform deduplication. (#2007)
- Display the focus ring on
CheckBoxandSwitchelements. (#2242) - Prevent href navigation for disabled Pressables and Touchables. (#2299)
Linking.openURLsupportstargetvalue. (#2277)
Notes
StyleSheet runtime
StyleSheet has been rewritten to better separate the runtime from the compiler. The performance of the new merging runtime is on par with using css-modules. The core runtime is a standalone package called styleQ; refer to the styleQ documentation for more details.
The performance of inline styles has also been significantly improved, although StyleSheet still has to perform extra work to transform non-standard React Native styles and polyfill logical styles.
The StyleSheet import is now a standalone module. StyleSheet itself is a function that can be called to resolve styles to DOM className and style values, e.g.,
const [ className, inlineStyle ] = StyleSheet([ styles.root, prop.styles ])StyleSheet extraction
One of the benefits behind the new architecture is that StyleSheet can resolve compiled styles that conform to the expected format, whether they are produced by the built-in compiler or an external source. However, this is not yet recommended, as explained below.
Style compilers must produce annotated objects that are treated as class name maps, and classes are de-duplicated based on whether they share the same key, e.g.,
{
$$css: true,
display: 'display-class',
opacity: 'opacity-class'
}This is the first step towards allowing 3rd party tools to extract styles to static CSS files, and optionally dropping the client-side compiler, without needing to integrate deeply with the StyleSheet runtime or having to modify props/prop values in the source code, i.e., only the StyleSheet.create() call needs transforming by the compiler.
The existence of the StyleSheet.flatten() API is a problem for build-time compiling of some styles. Components that flatten styles (e.g., Animated, Image) expect to be able to work with the source styles, and use the source values at runtime. A compiler that aims to extract all styles and have no runtime transform would also need to disallow the use of StyleSheet.flatten() entirely. A future release of React Native for Web may remove use of StyleSheet.flatten from internal implementations, but cannot prevent this API from being used in product code or 3rd party packages.
0.17.0
Accessibility improvements and breaking changes to unstable APIs.
Breaking changes
- Remove special treatment of elements with
accessibilityRole="menuitem". It no longer adds elements to the tab flow. - Remove anchor element inference from
ViewandTextwithaccessibilityRole="link". Only requires addition ofhrefprop. - Remove
unstable_createElementelement-type inference usinghref. Fixes use with svg elements. - Remove
unstable_createElementkeyboard shim foronClick. It no longer invokesonClickduringonKeyDownfor keyboard interactions on elements that are not natively interactive.
Fixes
- Fix
Pressablesupport for keyboard interactions if element is unmounted during interaction. - Remove unnecessary CSS reset for input number spin buttons.
- Fix
ProgressBar&Switchrendering in Windows High Contrast mode Textpreserves white-space ifnumberOfLines={1}.
0.16
This release includes Flow type exports, updates vendored modules, and miscellaneous bug fixes.
Breaking changes
Animated&VirtualizedListhave been updated from React Native.Dimensionshas changed the source ofwindowdimensions and works more reliably in Safari.NativeEventEmitterno longer inherits fromEventEmitterand does not include theremoveSubscriptionmethod.
New features
- Flow types are now exported. Thanks @comp615
0.15.0
This release introduces improved accessibility features and new documentation. It includes relatively minor breaking changes.
Breaking changes
- React 17 is a peer dependency.
- The
I18nManagerAPI has removed theisRTLanddoLeftAndRightSwapInRTLproperties. They must now be accessed using thegetConstants()method, which returns an object with the same properties. This was an undocumented breaking change in a previous version of React Native. - The
focusableprop now determines whether an element appears in the keyboard tab flow. - The
hrefAttrsprop has been added toTextandView. The value is an object withrel,target, anddownloadproperties. This replaces the undocumentedrelandtargetprops. - The automatic addition of
rel="noopener"to anchors has been removed. - The
Linking.openURL(url)API now opens the url in new tab. - The
LinkingAPI now includes theaddEventListenermethods. - The deprecated
importantForAccessibilityprop has been removed. UseaccessibilityHiddeninstead. - The undocumented
data-focusableattribute has also been removed from rendered DOM nodes. - The undocumented
disabledprop has been removed fromViewandText; useaccessibilityDisabledinstead.
New features
- Pressable has added
onHoverInandonHoverOutprops. - All ARIA properties are now supported via equivalent
accessibility*props. The undocumented support foraria-*prop forwarding remains and will be removed in a future version. - Additional
accessibilityRolevalues are mapped to HTML element equivalents. - CSS
aspectRatioproperty is now available in browsers with support.
Deprecations
- The
accessibleprop is deprecated and will be removed in the next minor release. React Native for Web will follow React Native for Windows/macOS in removing this prop. Usefocusableinstead.
Documentation
This release will include a rewrite of the documentation site and interactive examples.
https://necolas.github.io/react-native-web/
The examples will be embedded in relevant pages via a Next.js-powered codesandbox, making it easy for people to fork the example app from their browsers.
0.14.0
This is a relatively small release that introduces a couple of new features and makes a change to the default flexBasis value of View. There are no breaking API changes and it should be straight-forward to upgrade from 0.13. Thank you to Twitter Engineering and everyone else who tested and helped to improve the 0.14 release.
Breaking changes
Default flex-basis value of Views
React Native has an implementation of flexbox that does not quite follow the W3C spec for flexbox. Previously, React Native for Web attempted to replicate the React Native rendering by setting flexBasis to 0%. However, this created its own problems where views could collapse down to 0px in height on the web. This patch sets the default flexBasis back to auto. This will occasionally cause different rendering inconsistencies with React Native, which can be addressed by making changes small to existing React Native styles to set the flexBasis back to 0% or the desired percentage. And ultimately, Yoga 2 intends to correct its flexbox implementation and this will make its way into React Native eventually.
New features
Modal implementation
A Modal implementation using CSS animations and ARIA, courtesy of @imnotjames. When the modal is open the rest of the app is hidden from screen readers via aria-modal. Focus is contained within the modal. When the Escape key is pressed, the onRequestClose function is called on the top-most modal.
Fix #1020
Pressable support for hover state
The Pressable component state now includes hover, which scoped is scoped to a Pressable instance and does not bubble to ancestor Pressables. This behavior aligns with the behavior of the focus and press states.
<Pressable
children={
({ pressed, hovered, focused }) => {}
}
style={
({ pressed, hovered, focused }) => {}
}
/>Fix #1708


