Files
react-native/Libraries/ReactNative/RootTag.js
T
Tim Yung a850d116dc RN: Create RootTag Type
Summary:
Creates a `RootTag` type and refactors the `RootTagContext` module a bit.

This creates space for eventually changing `RootTag` into an opaque type that is only created once by `AppContainer`, and only consumed by native abstractions.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: cpojer

Differential Revision: D21127173

fbshipit-source-id: 60177a6e5e02d6308e87f76d12a271114f8f8fe0
2020-04-21 19:15:53 -07:00

28 lines
565 B
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
* @format
*/
'use strict';
import * as React from 'react';
// TODO: Make this into an opaque type.
export type RootTag = number;
export const RootTagContext: React$Context<RootTag> = React.createContext<RootTag>(
0,
);
/**
* Intended to only be used by `AppContainer`.
*/
export function createRootTag(rootTag: number): RootTag {
return rootTag;
}