Repository navigation
Run the example on @rootnative/web, and fix hitSlop, scrims and the search landmark on the web - #5
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR moves the example app to
@rootnative/webon the web, and adds browser tests that check the components on both web runtimes. It also fixes three faults of the components on the web.The RTL fix of the first version of this PR (
7e77103) is onmainnow.1. The example on
@rootnative/webOn the web, the example runs on
@rootnative/web-expo~0.0.9in place of react-native-web.withRootNativeinexample/metro.config.jssends eachreact-nativeand react-native-web import to the package. WithEXAMPLE_WEB_RUNTIME=react-native-web, Metro skips the wrap, and Expo's default runtime serves the web.@rootnative/web.b369c8f). Before,/rtlin RTL failed hydration (React error #418) on both runtimes.Commits:
53bcf29,70564a0,9a23c84,b6a10b2,bc20482,b03f7b1.2. Component fixes
hitSlopon the web (687b113)Button,Switch,ButtonGroup,Chip,Avatar,ListItemandCardturnedhitSlopoff on the web. They now pass it on each platform, so a web runtime that has the prop gets the 48dp touch target. react-native-web drops the prop, so nothing changes there.web/hit-slop.web.test.tsx(7 cases). On react-native-web, each component renders with nohitslopattribute and no warning.docs/docs/accessibility.mdnow says that react-native-web doesn't correct touch targets.A click on the scrim closes the overlay (
8376794)On react-native-web, a click on the scrim didn't close a
Dialogor aBottomSheetafter its entrance ended.SideSheetandNavigationDrawerhad the same fault. Escape worked.The cause: the animated layer has
pointerEvents: 'box-none'in its style. Reanimated writes that style inline, CSS has nobox-nonevalue, and the browser drops it. The full-size layer then takes each click over the scrim.animatedBoxNoneininternal/pointerEvents.ts:noneon the web,box-noneon native. Each surface getspointerEvents.auto.Dialog,BottomSheet,SideSheet,NavigationDrawerandSearchViewuse it.e2e/sheets.spec.ts. The jsdom tests can't see this fault. Only the browser tests do.SearchBarand theSearchViewheader are a search landmark (05455df)React Native's
accessibilityRole="search"names a search field. react-native-web renders it on aViewas thesearchlandmark, but@rootnative/webrenders it assearchbox, the role of the input inside.internal/searchLandmark.ts:role="search"on the web,accessibilityRole="search"on native. So both web runtimes give the landmark.3. Docs
The Installation page and the introduction name both web runtimes, with
@rootnative/webas the recommended one (af592cc).llms.txtandllms-full.txtsay the same (87f39a0). The Installation page also says thathitSlophas no effect only on react-native-web.4. Browser tests
example/e2e/has a Playwright suite: 297 tests in 13 spec files.CI:
browser-testsjob exports the example once for each web runtime. It runs the suite in Chromium, Firefox and WebKit (c4dc7f0,2caf52a).release.ymlandrelease-manual.ymlrun the same job when no CI result exists for the commit (20713c5).2caf52a: 891 tests passed on each runtime (297 × 3 engines), on the first try.Benchmark
@rootnative/web0.0.8 against react-native-web 0.21.4: two production exports of one tree, 10 runs each, 4x CPU slowdown, 1280 × 800, medians. The example is on 0.0.9 now. 0.0.9 changes onlyScrollViewsnapping and theroleofTextInput./text-fieldit's 74 % higher. The multilineTextInputhasfield-sizing: content, so the browser reads the font in the style pass, not in the layout pass. The sum of style and layout time there is 10 % lower (128 against 142 ms).Not in this PR
Slidermoves its thumb through React state, one render for each pixel. A shared value would help on each runtime./i18n(hreflang). I didn't compare it with react-native-web yet.hitSlopon a real touch device, and vertical overflow at the bottom edge of a page.componentsandseostill run on react-native-web. The browser tests cover both runtimes.After the merge
The merge deploys the docs and the demo, so release 0.0.4 right after it. The release notes need these lines:
main(7e77103).hitSlopon the web.