-
Notifications
You must be signed in to change notification settings - Fork 46.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove ReactFabricPublicInstance and used definition from ReactNative…
…PrivateInterface (#26437) ## Summary Now that React Native owns the definition for public instances in Fabric and ReactNativePrivateInterface provides the methods to create instances and access private fields (see facebook/react-native#36570), we can remove the definitions from React. After this PR, React Native public instances will be opaque types for React and it will only handle their creation but not their definition. This will make RN similar to DOM in how public instances are handled. This is a new version of #26418 which was closed without merging. ## How did you test this change? * Existing tests. * Manually synced the changes in this PR to React Native and tested it end to end in Meta's infra.
- Loading branch information
1 parent
f77099b
commit 9c54b29
Showing
13 changed files
with
96 additions
and
455 deletions.
There are no files selected for viewing
This file contains 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
153 changes: 0 additions & 153 deletions
153
packages/react-native-renderer/src/ReactFabricPublicInstance.js
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
packages/react-native-renderer/src/ReactFabricPublicInstanceUtils.js
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
21 changes: 21 additions & 0 deletions
21
...native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/createPublicInstance.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and 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 | ||
*/ | ||
|
||
import type {PublicInstance} from './ReactNativePrivateInterface'; | ||
|
||
export default function createPublicInstance( | ||
tag: number, | ||
viewConfig: mixed, | ||
internalInstanceHandle: mixed, | ||
): PublicInstance { | ||
return { | ||
__nativeTag: tag, | ||
__internalInstanceHandle: internalInstanceHandle, | ||
}; | ||
} |
16 changes: 16 additions & 0 deletions
16
...derer/src/__mocks__/react-native/Libraries/ReactPrivate/getNativeTagFromPublicInstance.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and 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 | ||
*/ | ||
|
||
import type {PublicInstance} from './ReactNativePrivateInterface'; | ||
|
||
export default function getNativeTagFromPublicInstance( | ||
publicInstance: PublicInstance, | ||
) { | ||
return publicInstance.__nativeTag; | ||
} |
20 changes: 20 additions & 0 deletions
20
...e-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/getNodeFromPublicInstance.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and 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 | ||
*/ | ||
|
||
import type {PublicInstance} from './ReactNativePrivateInterface'; | ||
|
||
import {getNodeFromInternalInstanceHandle} from '../../../../ReactNativePublicCompat'; | ||
|
||
export default function getNodeFromPublicInstance( | ||
publicInstance: PublicInstance, | ||
) { | ||
return getNodeFromInternalInstanceHandle( | ||
publicInstance.__internalInstanceHandle, | ||
); | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.