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

fix: react-native-windows implementation for new architecture #2527

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions apps/common/example/examples/Reanimated.windows.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import {StyleSheet, Text} from 'react-native';

function ReanimatedRectExample() {
return (
<Text>
Reanimated not supported in react-native-windows new arch currently
</Text>
);
}
ReanimatedRectExample.title = 'reanimated rectangle';

const title = 'Reanimated';
const samples = [ReanimatedRectExample];

const style = StyleSheet.create({text: {width: 30, height: 30}});
const icon = <Text style={style.text}>R</Text>;

export {icon, samples};
49 changes: 49 additions & 0 deletions apps/common/noNavigationApp.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Sample React Native App for react-native-svg library
* https://github.com/software-mansion/react-native-svg/tree/main/apps/common/example
*/

/**
* This is a very simple render of the examples for react-native-svg library, to avoid dependencies on @react-navigation,
* which may not be fully supported on all platforms and versions of react-native
*/
'use strict';

import React from 'react';
import {ScrollView, Text, View} from 'react-native';
import {examples} from './example/examples';
import type {Example} from './example/utils/types';
import {commonStyles} from './example/utils/commonStyles';

const ExampleBlock = ({example, index}: {example: Example; index: number}) => {
if (Array.isArray(example.samples)) {
return (
<View
key={index}
style={{borderWidth: 1, margin: 15, padding: 15, borderRadius: 5}}>
{example.icon}
<View style={[commonStyles.separator, {margin: 10}]} />
{example.samples.map((sample, index) => {
return (
<View key={index} style={{margin: 15}}>
<Text style={commonStyles.title}>{sample.title}</Text>
{sample({})}
</View>
);
})}
</View>
);
}

throw new Error('Unhandled Example type');
};

export default function App() {
return (
<ScrollView>
{Object.values(examples).map((example, index) => {
return <ExampleBlock example={example} index={index} key={index} />;
})}
</ScrollView>
);
}
3 changes: 3 additions & 0 deletions apps/fabric-windows-example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ yarn-error.log
**/fastlane/screenshots
**/fastlane/test_output

# Locally installed nuget packages
/windows/packages

# Bundle artifact
*.jsbundle

Expand Down
3 changes: 0 additions & 3 deletions apps/fabric-windows-example/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
module.exports = {
presets: ['module:@react-native/babel-preset'],
plugins: [
'react-native-reanimated/plugin',
],
};
5 changes: 4 additions & 1 deletion apps/fabric-windows-example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
*/

import {AppRegistry} from 'react-native';
import App from '../common';
import App from '../common/noNavigationApp';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);


AppRegistry.registerComponent("Example", () => App);
3 changes: 1 addition & 2 deletions apps/fabric-windows-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"dependencies": {
"react": "18.2.0",
"react-native": "0.74.2",
"react-native-windows": "0.74.9",
"react-native-reanimated": "3.9.0",
"react-native-windows": "0.74.23",
"react-native-svg": "link:../../"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ void UpdateRootViewSizeToAppWindow(
winrt::Microsoft::UI::Windowing::OverlappedPresenterState::Minimized) {
winrt::Microsoft::ReactNative::LayoutConstraints constraints;
constraints.MaximumSize = constraints.MinimumSize = size;
constraints.LayoutDirection =
winrt::Microsoft::ReactNative::LayoutDirection::Undefined;
rootView.Arrange(constraints, {0, 0});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<SDLCheck>true</SDLCheck>
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>shell32.lib;user32.lib;windowsapp.lib;%(AdditionalDependenices)</AdditionalDependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"native,Version=v0.0": {
"boost": {
"type": "Direct",
"requested": "[1.76.0, )",
"resolved": "1.76.0",
"contentHash": "p+w3YvNdXL8Cu9Fzrmexssu0tZbWxuf6ywsQqHjDlKFE5ojXHof1HIyMC3zDLfLnh80dIeFcEUAuR2Asg/XHRA=="
"requested": "[1.83.0, )",
"resolved": "1.83.0",
"contentHash": "cy53VNMzysEMvhBixDe8ujPk67Fcj3v6FPHQnH91NYJNLHpc6jxa2xq9ruCaaJjE4M3YrGSHDi4uUSTGBWw6EQ=="
},
"Microsoft.JavaScript.Hermes": {
"type": "Direct",
"requested": "[0.1.21, )",
"resolved": "0.1.21",
"contentHash": "5njCh+3eXTLOv7+8nOnp6nJ5C0r6it5ze54c0nuWleeDptuK8t3dEDB79XTU4D5DKNvAPlqJpgXRDOak5nYIug=="
"requested": "[0.1.23, )",
"resolved": "0.1.23",
"contentHash": "cA9t1GjY4Yo0JD1AfA//e1lOwk48hLANfuX6GXrikmEBNZVr2TIX5ONJt5tqCnpZyLz6xGiPDgTfFNKbSfb21g=="
},
"Microsoft.VCRTForwarders.140": {
"type": "Direct",
Expand All @@ -35,6 +35,19 @@
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
}
},
"Microsoft.UI.Xaml": {
"type": "Transitive",
"resolved": "2.8.0",
"contentHash": "vxdHxTr63s5KVtNddMFpgvjBjUH50z7seq/5jLWmmSuf8poxg+sXrywkofUdE8ZstbpO9y3FL/IXXUcPYbeesA==",
"dependencies": {
"Microsoft.Web.WebView2": "1.0.1264.42"
}
},
"Microsoft.Web.WebView2": {
"type": "Transitive",
"resolved": "1.0.1264.42",
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
},
"Microsoft.Windows.SDK.BuildTools": {
"type": "Transitive",
"resolved": "10.0.22621.756",
Expand All @@ -43,7 +56,7 @@
"common": {
"type": "Project",
"dependencies": {
"boost": "[1.76.0, )"
"boost": "[1.83.0, )"
}
},
"fmt": {
Expand All @@ -53,25 +66,32 @@
"type": "Project",
"dependencies": {
"Fmt": "[1.0.0, )",
"boost": "[1.76.0, )"
"boost": "[1.83.0, )"
}
},
"microsoft.reactnative": {
"type": "Project",
"dependencies": {
"Common": "[1.0.0, )",
"Folly": "[1.0.0, )",
"Microsoft.JavaScript.Hermes": "[0.1.21, )",
"Microsoft.JavaScript.Hermes": "[0.1.23, )",
"Microsoft.WindowsAppSDK": "[1.5.240227000, )",
"ReactCommon": "[1.0.0, )",
"boost": "[1.76.0, )"
"boost": "[1.83.0, )"
}
},
"reactcommon": {
"type": "Project",
"dependencies": {
"Folly": "[1.0.0, )",
"boost": "[1.76.0, )"
"boost": "[1.83.0, )"
}
},
"reactnativeasyncstorage": {
"type": "Project",
"dependencies": {
"Microsoft.ReactNative": "[1.0.0, )",
"Microsoft.UI.Xaml": "[2.8.0, )"
}
},
"rnsvg": {
Expand All @@ -80,7 +100,7 @@
"Microsoft.ReactNative": "[1.0.0, )",
"Microsoft.VCRTForwarders.140": "[1.0.2-rc, )",
"Microsoft.WindowsAppSDK": "[1.5.240227000, )",
"boost": "[1.76.0, )"
"boost": "[1.83.0, )"
}
}
},
Expand All @@ -99,6 +119,11 @@
"dependencies": {
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
}
},
"Microsoft.Web.WebView2": {
"type": "Transitive",
"resolved": "1.0.1264.42",
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
}
},
"native,Version=v0.0/win-arm64": {
Expand All @@ -116,6 +141,11 @@
"dependencies": {
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
}
},
"Microsoft.Web.WebView2": {
"type": "Transitive",
"resolved": "1.0.1264.42",
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
}
},
"native,Version=v0.0/win-x64": {
Expand All @@ -133,6 +163,11 @@
"dependencies": {
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
}
},
"Microsoft.Web.WebView2": {
"type": "Transitive",
"resolved": "1.0.1264.42",
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
}
},
"native,Version=v0.0/win-x86": {
Expand All @@ -150,6 +185,11 @@
"dependencies": {
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
}
},
"Microsoft.Web.WebView2": {
"type": "Transitive",
"resolved": "1.0.1264.42",
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
}
}
}
Expand Down
Loading