Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to enable React Native web capabilities? #21

Open
necolas opened this issue Feb 21, 2024 · 2 comments
Open

How to enable React Native web capabilities? #21

necolas opened this issue Feb 21, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@necolas
Copy link
Contributor

necolas commented Feb 21, 2024

Describe the feature request

React Native does not document how to enable the various web capabilities currently implemented on the Fabric architecture in the canary releases. Once that is available we can provide OSS users of RSD with specific instructions on how to use features that we currently rely on internally.

@necolas necolas added the documentation Improvements or additions to documentation label Feb 21, 2024
@necolas
Copy link
Contributor Author

necolas commented Mar 30, 2024

Does this look about right @rubennorte?

const ReactNativeFeatureFlags = require('react-native/src/private/featureflags/ReactNativeFeatureFlags');

ReactNativeFeatureFlags.override({
  // RuntimeScheduler processing the event loop will batch/dispatch rendering together at the end of each loop iteration
  batchRenderingUpdatesInEventLoop: () => boolean,
  // Enables access to the host tree in Fabric using DOM-compatible APIs.
  enableAccessToHostTreeInFabric: () => boolean,
  // Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).
  enableMicrotasks: () => boolean,
  // Dispatches state updates synchronously in Fabric (e.g.: updates the scroll position synchronously)
  enableSynchronousStateUpdates: () => boolean,
});

@rubennorte
Copy link

Does this look about right @rubennorte?

const ReactNativeFeatureFlags = require('react-native/src/private/featureflags/ReactNativeFeatureFlags');

ReactNativeFeatureFlags.override({
  // RuntimeScheduler processing the event loop will batch/dispatch rendering together at the end of each loop iteration
  batchRenderingUpdatesInEventLoop: () => boolean,
  // Enables access to the host tree in Fabric using DOM-compatible APIs.
  enableAccessToHostTreeInFabric: () => boolean,
  // Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).
  enableMicrotasks: () => boolean,
  // Dispatches state updates synchronously in Fabric (e.g.: updates the scroll position synchronously)
  enableSynchronousStateUpdates: () => boolean,
});

Those feature flags are internal, so users shouldn't access them directly. The only one we haven't enabled yet is the one to access the DOM tree. Let me talk to folks working on releases to see what's the right path forward for those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants