-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hook up fabric view component codegen (#7759)
* Hook up view component codegen * Change files * Dont use relative imports * format * Change files * Run codegen for all the view components * fix path * change to ignore codegen formatting * x86 build fix * Add clang-format override file for codegen * codegen uses LF * yse yargs required * tmp * readd codegen'd files using LF * Disable sort includes on the codegen files * updated clang-format file
- Loading branch information
1 parent
97aee65
commit 36e48e2
Showing
27 changed files
with
1,452 additions
and
30 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
7 changes: 7 additions & 0 deletions
7
change/@react-native-windows-codegen-8bf5b93f-6631-4c78-9860-a9e27b71521e.json
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,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Hook up view component codegen", | ||
"packageName": "@react-native-windows/codegen", | ||
"email": "30809111+acoates-ms@users.noreply.github.com", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@rnw-scripts-format-files-04311b1d-6be6-4a29-a7ad-193f9d1481e8.json
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,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Dont format files in codegen", | ||
"packageName": "@rnw-scripts/format-files", | ||
"email": "30809111+acoates-ms@users.noreply.github.com", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/react-native-windows-5b852b93-ed97-49c0-a263-a649a03c12fa.json
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,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Hook up view component codegen", | ||
"packageName": "react-native-windows", | ||
"email": "30809111+acoates-ms@users.noreply.github.com", | ||
"dependentChangeType": "patch" | ||
} |
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
82 changes: 82 additions & 0 deletions
82
vnext/Microsoft.ReactNative/Fabric/ActivityIndicatorComponentView.cpp
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,82 @@ | ||
|
||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
#pragma once | ||
|
||
#include "ActivityIndicatorComponentView.h" | ||
|
||
#include <UI.Xaml.Controls.h> | ||
#include <Utils/ValueUtils.h> | ||
|
||
#include <react/components/rnwcore/Props.h> | ||
|
||
namespace Microsoft::ReactNative { | ||
|
||
ActivityIndicatorComponentView::ActivityIndicatorComponentView() : m_element(xaml::Controls::ProgressRing()) { | ||
static auto const defaultProps = std::make_shared<facebook::react::ActivityIndicatorViewProps const>(); | ||
m_props = defaultProps; | ||
} | ||
|
||
std::vector<facebook::react::ComponentDescriptorProvider> | ||
ActivityIndicatorComponentView::supplementalComponentDescriptorProviders() noexcept { | ||
return {}; | ||
} | ||
|
||
void ActivityIndicatorComponentView::mountChildComponentView( | ||
const IComponentView &childComponentView, | ||
uint32_t index) noexcept { | ||
assert(false); | ||
} | ||
|
||
void ActivityIndicatorComponentView::unmountChildComponentView( | ||
const IComponentView &childComponentView, | ||
uint32_t index) noexcept { | ||
assert(false); | ||
} | ||
|
||
void ActivityIndicatorComponentView::updateProps( | ||
facebook::react::Props::Shared const &props, | ||
facebook::react::Props::Shared const &oldProps) noexcept { | ||
const auto &oldActivityProps = *std::static_pointer_cast<const facebook::react::ActivityIndicatorViewProps>(m_props); | ||
const auto &newActivityProps = *std::static_pointer_cast<const facebook::react::ActivityIndicatorViewProps>(props); | ||
|
||
if (oldActivityProps.animating != newActivityProps.animating) { | ||
m_element.IsActive(newActivityProps.animating); | ||
} | ||
|
||
if (oldActivityProps.color != newActivityProps.color) { | ||
m_element.Foreground(SolidColorBrushFrom(newActivityProps.color)); | ||
} | ||
|
||
m_props = std::static_pointer_cast<facebook::react::ActivityIndicatorViewProps const>(props); | ||
} | ||
|
||
void ActivityIndicatorComponentView::updateState( | ||
facebook::react::State::Shared const &state, | ||
facebook::react::State::Shared const &oldState) noexcept {} | ||
void ActivityIndicatorComponentView::updateLayoutMetrics( | ||
facebook::react::LayoutMetrics const &layoutMetrics, | ||
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept { | ||
// Set Position & Size Properties | ||
|
||
m_layoutMetrics = layoutMetrics; | ||
|
||
winrt::Microsoft::ReactNative::ViewPanel::SetLeft(m_element, layoutMetrics.frame.origin.x); | ||
winrt::Microsoft::ReactNative::ViewPanel::SetTop(m_element, layoutMetrics.frame.origin.y); | ||
|
||
m_element.Width(layoutMetrics.frame.size.width); | ||
m_element.Height(layoutMetrics.frame.size.height); | ||
} | ||
void ActivityIndicatorComponentView::finalizeUpdates(RNComponentViewUpdateMask updateMask) noexcept {} | ||
void ActivityIndicatorComponentView::prepareForRecycle() noexcept {} | ||
facebook::react::SharedProps ActivityIndicatorComponentView::props() noexcept { | ||
assert(false); | ||
return {}; | ||
} | ||
|
||
const xaml::FrameworkElement ActivityIndicatorComponentView::Element() const noexcept { | ||
return m_element; | ||
} | ||
|
||
} // namespace Microsoft::ReactNative |
46 changes: 46 additions & 0 deletions
46
vnext/Microsoft.ReactNative/Fabric/ActivityIndicatorComponentView.h
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,46 @@ | ||
|
||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
#pragma once | ||
|
||
#include "ComponentView.h" | ||
|
||
#include <Microsoft.ReactNative.Cxx/ReactContext.h> | ||
#include <UI.Xaml.Controls.h> | ||
#include "ViewComponentView.h" | ||
|
||
#pragma warning(push) | ||
#pragma warning(disable : 4244 4305) | ||
#include <react/renderer/components/view/ViewProps.h> | ||
#pragma warning(pop) | ||
|
||
namespace Microsoft::ReactNative { | ||
|
||
struct ActivityIndicatorComponentView : BaseComponentView { | ||
ActivityIndicatorComponentView(); | ||
|
||
std::vector<facebook::react::ComponentDescriptorProvider> supplementalComponentDescriptorProviders() noexcept | ||
override; | ||
void mountChildComponentView(const IComponentView &childComponentView, uint32_t index) noexcept override; | ||
void unmountChildComponentView(const IComponentView &childComponentView, uint32_t index) noexcept override; | ||
void updateProps(facebook::react::Props::Shared const &props, facebook::react::Props::Shared const &oldProps) noexcept | ||
override; | ||
void updateState(facebook::react::State::Shared const &state, facebook::react::State::Shared const &oldState) noexcept | ||
override; | ||
void updateLayoutMetrics( | ||
facebook::react::LayoutMetrics const &layoutMetrics, | ||
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept override; | ||
void finalizeUpdates(RNComponentViewUpdateMask updateMask) noexcept override; | ||
void prepareForRecycle() noexcept override; | ||
facebook::react::SharedProps props() noexcept override; | ||
|
||
const xaml::FrameworkElement Element() const noexcept override; | ||
|
||
private: | ||
facebook::react::SharedViewProps m_props; | ||
facebook::react::LayoutMetrics m_layoutMetrics; | ||
xaml::Controls::ProgressRing m_element; | ||
}; | ||
|
||
} // namespace Microsoft::ReactNative |
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
5 changes: 5 additions & 0 deletions
5
vnext/Microsoft.ReactNative/Fabric/platform/react/components/image/conversions.h
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,5 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// RN has some weird include directory redirections..this forwards the include to the right place | ||
#include <react/renderer/components/image/conversions.h> |
5 changes: 5 additions & 0 deletions
5
vnext/Microsoft.ReactNative/Fabric/platform/react/components/view/ConcreteViewShadowNode.h
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,5 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// RN has some weird include directory redirections..this forwards the include to the right place | ||
#include <react/renderer/components/view/ConcreteViewShadowNode.h> |
5 changes: 5 additions & 0 deletions
5
vnext/Microsoft.ReactNative/Fabric/platform/react/components/view/ViewEventEmitter.h
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,5 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// RN has some weird include directory redirections..this forwards the include to the right place | ||
#include <react/renderer/components/view/ViewEventEmitter.h> |
5 changes: 5 additions & 0 deletions
5
vnext/Microsoft.ReactNative/Fabric/platform/react/components/view/ViewProps.h
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,5 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// RN has some weird include directory redirections..this forwards the include to the right place | ||
#include <react/renderer/components/view/ViewProps.h> |
5 changes: 5 additions & 0 deletions
5
vnext/Microsoft.ReactNative/Fabric/platform/react/core/ConcreteComponentDescriptor.h
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,5 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// RN has some weird include directory redirections..this forwards the include to the right place | ||
#include <react/renderer/core/ConcreteComponentDescriptor.h> |
5 changes: 5 additions & 0 deletions
5
vnext/Microsoft.ReactNative/Fabric/platform/react/core/propsConversions.h
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,5 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// RN has some weird include directory redirections..this forwards the include to the right place | ||
#include <react/renderer/core/propsConversions.h> |
5 changes: 5 additions & 0 deletions
5
vnext/Microsoft.ReactNative/Fabric/platform/react/graphics/Color.h
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,5 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// RN has some weird include directory redirections..this forwards the include to the right place | ||
#include <react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.h> |
Oops, something went wrong.