Welcome to Knowledge Base!

KB at your finger tips

This is one stop global knowledge base where you can learn about all the products, solutions and support features.

Categories
All
Mobile-React Native
The GAAD Pledge - March Accessibility Issues Update · React Native

The GAAD Pledge - March Accessibility Issues Update

· 3 min read

It has been four weeks since we reached out to the GitHub community with a thoroughly reviewed gap analysis and list of issues to improve React Native's accessibility. With the help of the React Native community, we are already making great progress on improving accessibility. Community members have been helping contributors, reviewing tests, and bringing attention to prior accessibility issues. Since March 8th the community has closed six issues with four pull requests and seven other pull requests are in the pipeline for review.

While this work continues, the React Native and Accessibility teams at Facebook are evaluating accessibility bugs and issues that were submitted prior to this initiative, to determine if they are already covered by our current gap analysis or if there are additional issues that need to be brought into the project. One new issue has already been discovered and moved into the project, four others directly mapped to existing issues and two others are expected to be closed by addressing existing issues that address the root cause of their issue.

Thank you to all the community members who have participated. You are truly moving the needle in making React Native more accessible for everyone!

Closed Pull Requests 🎉​

  • Added talkback support for button accessibility: disabled prop #31001 - closed by @huzaifaaak

  • feat: set disabled accessibilityState when TouchableHighlight is disabled #31135 closed by @natural_clar

  • [Android] Selected State does not annonce when TextInput Component selected #31144 closed by fabriziobertoglio1987

  • Added talkback support for TouchableNativeFeedback accessibility: disabled prop #31224 closed by @kyamashiro73

  • Accessibility/button test #31189 closed by @huzaifaaak

    • Adds a test for accessibilityState for button

Fixes​

  • Button component (fixed by #31001):

    • Now announces when it is disabled

    • Disables click functionality for screen readers when the button is disabled

    • Announces the selected state of the button

  • TextInput component (fixed by #31144):

    • Announces "selected" when the "selected" accessibilityState is set to true and the element is focused
  • TouchableHighlight component (fixed by #31135):

    • Disables click functionality for screen readers when the component is disabled
  • TouchableNativeFeedback component (fixed by #31224):

    • Disables click functionality for screen readers when the component is disabled

Other Progress​

Status Number of Issues
Issues To Do 53
In Progress Issues by the Community 8
In Progress Issues by React Native Team 5
Pull Request in Progress 3
Pull Request in Reviews 4

Get involved!​

  • New contributors should read the contribution guide and browse the list of 37 good first issues in the React Native GitHub.

  • Contributors interested in issues requiring a bit more effort should visit the project page for Improved React Native Accessibility to see the GitHub issues that need their knowledge of React Native.

  • Technical writers interested in updating React Native's documentation to reflect the accessibility gaps being closed should visit the React Native Docs.

  • Share this initiative with anyone who may be able to help!

  • Follow the GAAD Pledge Open Source Accessibility Community Manager for React Native on Twitter or Facebook to keep up to date on progress.

Tags:
  • announcement
The GAAD Pledge - One Year Later · React Native

The GAAD Pledge - One Year Later

· 4 min read

It has been one year since Facebook took the GAAD Pledge to make React Native accessible and the project has exceeded our expectations. We are excited to announce that this project will continue throughout 2021 and want to update everyone on our progress so far. Following a thorough analysis of the accessibility gaps in React Native last year, work began on filling these gaps.

We started with 90 outstanding gap analysis issues and from March 2021, when the project launched on GitHub, until now:

  • 11 issues have been closed by the community.

  • 19 issues were evaluated and closed by the React Native team.

  • 9 pull requests were merged.

  • 1 pull request was merged into the React Native docs.

We want to recognize and thank the React Native community for the significant progress towards a more accessible React Native over the past year. Every contributor's effort has counted in making progress on improving React Native Accessibility.

Fixes​

Two types of issues have been fixed in multiple components and one new functionality has been added to the API by the 9 pull requests.

  • An issue with Disabled state has been addressed in seven components

  • An issue with Selected state was addressed in two components

  • A new addition to the React Native API added the ability to query AccessibilityManager.getRecommendedTimeoutMillis().

Disabled State Announcement and Disable function​

One of the most prevalent issues found during the gap analysis was that some components do not announce or disable functionality. Now seven components announce their disabled state or disable click functionality.

Announces when Disabled

  • Button - #31001

  • Images - #31252

  • ImageBackground - #31252

Disables click functionality when the component has a disabled prop

  • Button - #31001

  • Text - React Native Team commit

  • Pressable - React Native Team commit

  • TouchableHighlight - #31135

  • TouchableOpacity - #31108

  • TouchableNativeFeedback - #31224

  • TouchableWithoutFeedback - #31297

Selected State Announcement​

There were some components that did not announce their selection when in focus. This behavior has now been fixed when the component is in focus and the AccessibilityState is set to selected or the component is changed to selected.

Announces when Selected

  • Button - #31001

  • TextInput - #31144

Accessibility Timeout Setting​

There was previously no way to query the accessibility timeout setting on Android. The fix added the ability to query AccessibilityManager.getRecommendedTimeoutMillis() . This queries the "Time to take action" before the UI elements auto-dismisses or auto-progresses.

Documentation Additions​

The React Native documentation must be updated to reflect each addition or change to the available APIs. The new addition to the React Native documentation covered the addition of getRecommendedTimeoutMillis() to AccessibilityInfo.

Community Involvement​

We want to thank all the contributors mentioned below who have submitted and merged pull requests as well as those who have reviewed and commented on issues.

Merged Pull Requests​

  • @huzaifaaak closed 3 issues with:
    • Added talkback support for button accessibility: disabled prop #31001
    • Accessibility/button test #31189
  • @natural_clar closed 1 issue with:
    • feat: set disabled accessibilityState when TouchableHighlight is disabled #31135
  • fabriziobertoglio1987 closed 2 issues with:
    • [Android] Selected State does not annonce when TextInput Component selected #31144
    • Accessibility Fix Image does not announce "disabled" #31252
  • @kyamashiro73 closed 1 issue with:
    • Added talkback support for TouchableNativeFeedback accessibility: disabled prop #31224
  • @grgr-dkrk closed 1 issue and added to the React Native documentation with:
    • add getRecommendedTimeoutMillis to AccessibilityInfo #31063
    • feat: add getRecommendedTimeoutMillis section on accessibilityInfo #2581
  • @crloscuesta closed 1 issue with:
    • Disable accessibilityState when TouchableWithoutFeedback is disabled #31297
  • @chakrihacker closed 1 issue with:
    • Disable TouchableOpacity when accessibility disabled is set #31108

Thank you to the community members who gave their time in other ways!

Simek, saurabhkacholiya, meehawk, intergalacticspacehighway, chrisglein, jychiao and Waltari10

Get Involved!​

We've come a long way but we're not done yet. We need your support to reach the finish line. Facebook's React Native team has committed to supporting contributors working on gap analysis issues. They will continue to respond to comments on Accessibility issues and triage pull requests. The React Native team is also tackling some of the toughest gap analysis issues. This work includes the correct translation of accessibilityRoles to other languages and specifying error text for specific components.

Join us in tackling the rest. There are still open accessibility issues on the Improved React Native Accessibility project board. Issues with Checked/Unchecked State, Entrance/exit from Collection, and Position in Collection are great opportunities for current and new contributors to contribute to a more accessible React Native.

Learn More​

Read about how the gap analysis was conducted on the Facebook Tech blog or about the launch of the GitHub issues on the React Native Blog.

Tags:
  • announcement
Read article
Announcing React Native 0.65 · React Native

Announcing React Native 0.65

· 3 min read

Today we’re releasing React Native version 0.65 with a new version of Hermes, improvements to accessibility, package upgrades, and more.

What's new in Hermes 0.8?​

Hermes, Facebook’s open source JavaScript VM optimized for React Native, has been upgraded to version 0.8.1. Some of the stand-out features in this release are:

  • A new concurrent garbage collector titled “Hades” which delivers up to 30 times shorter pause times on 64 bit devices. At Facebook, we saw this improve some CPU-intensive workloads by 20%-50%. You can learn more about Hades here.
  • ECMAScript Internationalization API (ECMA-402, or Intl ) is now built into Hermes on Android and enabled by default, with only 57-62K per API size overhead (compared to JSC's 6MiB). With this change, Hermes users no longer require locale polyfills. A big thank you to @mganandraj and other partners at Microsoft for driving the implementation to make this happen!
  • Hermes on iOS now supports Apple M1 Macs and Mac Catalyst!
  • Memory improvements including SMI (Small Integers) and pointer compression that shrank JS heap by 30%.
  • Changes to Function.prototype.toString that fixed a performance drop due to improper feature detection and supports the source code injecting use case.

You can find the full Hermes changelog here.

Follow steps here to opt-in your app to Hermes if you haven’t already to leverage these new features and gains!

Accessibility Fixes and Additions​

Last year Facebook took the GAAD pledge to improve accessibility within React Native. 0.65 shares the results of this pledge and other accessibility wins! Some notable changes include:

  • Allow specification of high contrast light and dark values for iOS. See documentation for more details.
  • Added getRecommendedTimeoutMillis API on Android. This exposes a user’s preferred default timeout value as set in Android’s accessibility options and is for users who may need extra time to review or reach controls, etc.
  • General fixes to ensure TalkBack/VoiceOver properly announce UI states such as disabled and unselected on components.

You can follow along or contribute to our outstanding accessibility issues here!

Notable Dependency Version Updates and Gotchas​

  • react-native-codegen version 0.0.7 is now needed as a devDependency in the package.json .
  • JCenter has been sunsetted and read-only now. We have removed JCenter as a maven repository and updated dependencies to use MavenCentral and Jitpack.
  • Upgraded OkHttp from v3 to v4.9.1. See Upgrading to OkHttp 4 for more details on changes.
  • Upgraded to Flipper 0.93 to support Xcode 12.5. See Flipper changelog here.
  • Android Gradle Plugin 7 support
  • Apple Silicon requires a linker workaround. See @mikehardy’s note about this.

Thank You!​

This release includes over 1100 commits from 61 contributors . Thank you to everyone who has contributed and supported this release! You can find the full changelog here.

Tags:
  • announcement
  • release
Read article
React Native in H2 2021 · React Native

React Native in H2 2021

· 6 min read

Over the past year so much has changed in our world, React Native being no exception. We've welcomed new members to our team (whom we are excited to eventually meet in person!), our projects have matured and new opportunities have arisen. We're excited to share all this with you in this post and others to come!

At Facebook, our team works in half-year cycles. Each half we review our strategy, set plans, and share them internally. Today, we want to share our H2 plans with you, our community.

H2 2021 is an exciting half for React Native. Our areas of focus include nurturing the community, beginning to roll out the new architecture to open source, and pushing the technology forward.

Setting up the Community for Success​

React Native’s open source ecosystem is one of its greatest strengths. We’ve identified the following areas as the best ways to grow our partnership with the community.

Community Engagement​

In order for everyone to move in the same direction, we want to continually communicate our vision and status to the community. Sharing our incremental progress publicly isn’t second-nature for us (yet). This half, we are committing to a more consistent content schedule that exercises the muscle and sets up processes to reduce friction. Beyond sharing our updates, we also want to use this opportunity to showcase the accomplishments of the community.

New Architecture Rollout and Releases​

In H1, we finished rolling out the new React Native architecture to all React Native mobile products in the Facebook app. Facebook is made up of surfaces like Marketplace Tab and Dating Profile, and we have migrated over 1000 surfaces!

In H2, we are beginning to bring this new architecture to the community. We have put together a playbook that shows how to migrate libraries and applications. We have already shared drafts with early partners that maintain popular React Native libraries. We expect to get their feedback, support them in upgrading their libraries, and learn how to improve our playbook and implementations. We plan on sharing the playbook more broadly as soon as the work stabilizes.

We are also focused on improving React Native’s release process. We will need frequent reliable releases to progressively ship the new React Native architecture. Our aim is to catch release-blockers earlier and to reduce the turn-around time. This will enable more predictable release timelines with less burden on contributors and developers.

Repository Health​

When developers evaluate a technology, an essential signal is the health of its repository. This impression is informed by signals such as pull request throughput, stars, age of last commit, and others. The React Native repository has historically lacked a process to ensure that issues and pull requests are reviewed in a timely manner. Our work this half is two-fold: we need to resolve a large backlog of contributions, and we need to build sustainable practices for handling incoming contributions. We hope this work will also set us up for success for more engagement from the community via issues and PRs as the community starts using the new architecture. You can follow our progress on the backlog using this project board.

Pushing the Technology Forward​

New Architectural Capabilities​

As mentioned, our new architecture recently finished rolling out to the Facebook mobile apps! We are already building new capabilities that will change the performance curve for React Native. This includes supporting Concurrent Rendering in React Native. Concurrent Rendering enables React to pause and resume work and quickly respond to high priority events like a touch gesture. Something we are also really excited about is using Concurrent Rendering to make use of idle CPU cycles for rendering offscreen product features without slowing down onscreen user interactions.

Mobile and Beyond​

We have had overwhelming success with powering mobile experiences using React at Facebook, and we have seen amazing mobile products from our partners. Now we want to bring that success to more platforms! We believe that targeting many platforms lets us learn new lessons and further improve our offering on mobile platforms. (We will share more about this in a later post.) The exciting news is that we’ve already started taking steps towards making this a reality!

Messenger Desktop​

Last summer, we expanded our focus beyond mobile by partnering with Microsoft to accelerate React Native development on Windows and macOS. We partnered with the Messenger team at Facebook to enable user experiences that are only possible on desktop, and to deliver huge performance wins over their previous Electron implementation. Our vision is to combine high quality, delightful, native desktop user experiences with the great developer experience of React Native.

The Messenger team has ambitious plans for the Messenger desktop apps, including finding new ways to further unleash the unique capabilities of desktop platforms and large screens. We are excited to continue enabling these experiences by investing more into React Native on desktop.

React Native in Virtual Reality​

Oculus has long used React Native to power core experiences like Store, where people buy applications and games in VR. In H2, React Native and Oculus are partnering to bring new exciting experiences to VR. We are also bringing optimizations and improvements from VR to mobile, and from mobile to VR. This will include expanding React Native to support unique requirements of VR — from new input types like controllers to new memory usage optimizations. This is the start of an exciting journey to explore and influence how immersive experiences can built for VR using React Native.

Summary​

We hope our H2 plans excite you as much as it does us, and we look forward to sharing more with you in the upcoming months! We will also be attending React Native EU on September 1, 2021 where teammate Joshua Gross (@joshuaisgross) will share how we replaced the architecture for the world’s largest React Native app. Register for React Native EU if you haven’t already! In the meantime, connect with us on Twitter (@reactnative) for updates on events, our roadmap, and much more.

Tags:
  • announcement
Read article
React Native's Many Platform Vision · React Native

React Native's Many Platform Vision

· 8 min read
Eli White
Luna Wei
Timothy Yung

React Native has been very successful at raising the bar for mobile development, both at Facebook and elsewhere in the industry. As we interact with computers in new ways and as new devices are invented, we want React Native to be there for everyone. Although React Native was originally created to build mobile apps, we believe that focusing on many platforms and building to each platform’s strengths and constraints has a symbiotic effect. We have seen huge benefits when we extended this technology to desktop and virtual reality, and we're excited to share what this means for the future of React Native.

Respecting the Platform​

Our first guiding principle is to match the expectations people have for each platform. Android users expect accessible apps using TalkBack. Navigation should work the way it does in other Android apps. A button should look and feel the way buttons look and feel on Android. It should not look and feel like an iOS button. Although we seek to offer a consistent cross-platform developer experience, we resist the temptation to sacrifice users’ expectations.

We believe that React Native enables developers to meet users’ expectations while also gaining the benefits of a better developer experience. In this section, we share the following:

  1. By embracing platform constraints, we actually improve the experience on other platforms.
  2. We can learn from institutional knowledge to build higher level cross-platform abstractions.
  3. Other players on each platform inspire us to build better developer and user experiences.

Embracing Platform Constraints​

Specific device hardware or user expectations impose unique constraints and requirements. As an example, memory is typically more constrained on Android and VR headsets than on iOS, macOS, and Windows. As another example, users expect mobile apps to start up almost instantaneously, but they are less frustrated when desktop apps take longer to start up. We have found that by approaching these problems with React Native, we can more easily borrow lessons learned and code written for one platform, and apply them to other platforms.

Screenshot of Facebook Dating on mobile
React Native and Relay power over 1000 Facebook surfaces on Android and iOS.

For example, React Native relies on an optimization known as “view flattening” which is critical for reducing memory usage on Android. We never built this optimization for iOS because it does not bear the same memory constraints. Over the past few years as we built our new cross-platform renderer, we had to reimplement “view flattening”. But this time, it was written in C++ instead of platform-specific Java. Trying out this same optimization on iOS was now only a matter of flipping a switch. In the production Facebook app, we observed that this improved performance on iOS! We likely never would have built this for iOS, but our investment on Android was able to benefit our investment on iOS.

Learning from Institutional Knowledge​

One of the reasons that React Native was originally created was to reduce engineering silos. There is a tendency for Android engineers to be siloed from iOS engineers working on the same product. Android engineers review code for Android engineers and attend Android meetups and conferences. iOS engineers review code for iOS engineers and attend iOS meetups and conferences. Engineers working on different platforms bring unique domain and institutional knowledge about how to build great product experiences.

One of the best outcomes of cross-platform frameworks like React Native is how they bring together engineers with vastly different domain expertise. We believe that by targeting more platforms, we can accelerate cross-pollination of institutional knowledge between platform experts.

As an example, the accessibility abstractions in React Native are influenced by how Android, iOS, and web each approach accessibility in different ways. This enabled us to build a common interface that improves how accessibility hints are handled on both mobile platforms.

As another example, our research into user perception of speed on the web led to concurrent features like Suspense. Over the past year, these features were vetted by the new Facebook.com website. Now with our new renderer, these features are making their way to React Native and influencing how we design event scheduling and priorities. The React team’s investment into improving the web experience is benefiting React Native for native platforms.

Competition Drives Innovation​

In addition to domain-specific engineers and meetups and conferences, each platform also brings other unique players solving similar problems. On the web, React (which directly powers React Native) frequently draws inspiration from other open source web frameworks like Vue, Preact, and Svelte. On mobile, React Native has been inspired by other open source mobile frameworks, and we have been learning from other mobile frameworks built inside Facebook.

We believe that competition leads to better outcomes for everyone in the long run. By studying what makes other players on each platform great, we can learn lessons that may apply to other platforms. For example, the race to simplify complex websites influenced the development of React and gave React Native a head start to offer a declarative framework for mobile apps. The demand for faster iteration cycles and build times for the web also led to the development of Fast Refresh which significantly benefited React Native. Similarly, performance optimizations in our internal mobile frameworks — especially around data fetching and parallelization — challenged us to improve React Native in a way that has also influenced React when we built the new Facebook.com website.

Screenshot of the Facebook.com website
React and Relay powers the Facebook.com website.

Expanding to New Platforms​

React and React Native are at a turning point. React has started the road to a React 18 release, and the new React Native renderer is now fully powering the Facebook mobile apps. Our team has grown substantially this year in order to support the growing adoption at Facebook. Teams developing on other platforms have noticed the adoption and see the opportunity for them to also reap the benefits of React Native.

For the past year, we have been partnering with Microsoft and the Messenger team to create a truly native video calling experience on Windows and macOS. Due to the high scrutiny that we place on startup time for mobile apps, our initial implementation of desktop video calling using React Native completely blew away the performance of the Electron implementation that it replaced. For the first couple weeks of building this experience, we recorded videos of us resizing a window with multiple live video calls and marveled at the smooth frame rates.

Building for desktop has been very exciting for us. We have taken what we know about building mobile experiences and applied them to desktop with eyes wide open. We’ve expanded our horizons with multiple child windows, menu bars, system trays, and more. As we continue collaborating on new desktop Messenger features, we expect to find opportunities that influence how we build on web and mobile. If you want to stay up to date, our desktop collaboration work is taking place on GitHub.

Screenshot of the Messenger app on macOS
React Native powers Video Calling in Messenger for Windows and macOS.

We are also partnering more closely with Facebook Reality Labs to understand how React is uniquely positioned to deliver virtual reality experiences on Oculus. Building experiences in VR with React Native will be particularly interesting because of tighter memory constraints and user sensitivity to interaction latency.

Similar to how we approach React Native for mobile, we will be validating our technology at Facebook scale before we share anything publicly. A lot is still changing and we still have many questions. We want to have confidence that the technology is production-ready and reliable before sharing with the community.

Although most of the development for VR will still be internal, we hope to share more as soon as we can. We also anticipate that improvements to React Native for VR will surface in open source. For example, we anticipate that projects to reduce memory usage for VR use cases will also reduce memory usage for React Native on mobile and desktop experiences.

Screenshot of Oculus Home in virtual reality
React and Relay power the Oculus Home and many other virtual reality experiences.

When we reflect back on how the industry has adopted React, there has always been an appetite in the community for React on more platforms. Even before we announced React Native to the community, Netflix had already been crafting Gibbon, their custom renderer for building TV experiences with React. And before Facebook started building Messenger for desktop, Microsoft was already using React to build native desktop experiences in Office and Windows 10.

Summary​

In summary, our vision is to expand React Native's reach beyond mobile and we've already started by partnering with desktop and VR teams at Facebook. We know that when we embrace the platform constraints of each platform, learn from institutional knowledge, and gather inspiration from other players, it benefits every platform in the ecosystem. And most importantly, in doing so, we stay true to our guiding principles.

We are excited about what's to come as we continue to explore what many platforms unlocks for React Native. Connect with us (@reactnative) for more updates and share your thoughts!

Tags:
  • announcement
Read article