Skip to content

[0.75] [Fabric] Cherry pick changes #13638

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

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "replace IAppData.TemporaryFolder with GetTempPathW",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Rework custom components to not rely on open compose patterns",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "[Fabric] Fix ScrollViewComponentView object leak",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "[Fabric] Enable implementation of custom events on custom components",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,22 @@

import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
import type {DirectEventHandler} from 'react-native/Libraries/Types/CodegenTypes';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';

type MyEventEvent = $ReadOnly<{|
value: boolean,
target: Int32,
|}>;

type NativeProps = $ReadOnly<{|
...ViewProps,

// Props
label: string,

// Events
onMyEvent?: ?DirectEventHandler<MyEventEvent>,
|}>;

type ComponentType = HostComponent<NativeProps>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,22 @@

import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
import type {DirectEventHandler} from 'react-native/Libraries/Types/CodegenTypes';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';

type MyEventEvent = $ReadOnly<{|
value: boolean,
target: Int32,
|}>;

type NativeProps = $ReadOnly<{|
...ViewProps,

// Props
label: string,

// Events
onMyEvent?: ?DirectEventHandler<MyEventEvent>,
|}>;

type ComponentType = HostComponent<NativeProps>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,43 @@

'use strict';

import React from 'react';
import React, { useState } from 'react';
import {Text, View} from 'react-native';
import CustomXamlComponentWithNativeLayout from './CustomXamlComponentWithNativeLayoutNativeComponent';

const NativeComponentWithNativeLayout = () => {
let [log, setLog] = useState('');
return (
<View
style={{
borderRadius: 0,
margin: 10,
borderWidth: 2,
flexWrap: 'wrap',
flexDirection: 'row',
gap: 5,
}}>
<View style={{width: 100, height: 100, backgroundColor: 'green'}} />
<View style={{width: 100, height: 100, backgroundColor: 'red'}} />
<View style={{width: 100, height: 100, backgroundColor: 'blue'}} />
<View style={{width: 100, height: 100, backgroundColor: 'pink'}} />
<View style={{width: 100, height: 100, backgroundColor: 'gray'}} />
<Text style={{color: 'gray'}}>This is RN Text</Text>
<Text style={{color: 'red'}}>{log}</Text>
<CustomXamlComponentWithNativeLayout
label="This is a Xaml Button set to ellipisify on truncation"
style={{flexShrink: 1}}
onMyEvent={(arg) => {setLog(log + '\nRecieved MyEvent: ' + JSON.stringify(arg.nativeEvent) + '\n')}}
/>
<View style={{width: 100, height: 100, backgroundColor: 'green'}} />
<View style={{width: 100, height: 100, backgroundColor: 'red'}} />
<View style={{width: 100, height: 100, backgroundColor: 'blue'}} />
<View style={{width: 100, height: 100, backgroundColor: 'pink'}} />
<View style={{width: 100, height: 100, backgroundColor: 'gray'}} />
</View>
);
}

exports.displayName = 'NativeFabricComponent';
exports.framework = 'React';
exports.category = 'UI';
Expand All @@ -27,32 +60,8 @@ exports.examples = [
title: 'Native Component',
render: function (): React.Node {
return (
<View
style={{
borderRadius: 0,
margin: 10,
borderWidth: 2,
flexWrap: 'wrap',
flexDirection: 'row',
gap: 5,
}}>
<View style={{width: 100, height: 100, backgroundColor: 'green'}} />
<View style={{width: 100, height: 100, backgroundColor: 'red'}} />
<View style={{width: 100, height: 100, backgroundColor: 'blue'}} />
<View style={{width: 100, height: 100, backgroundColor: 'pink'}} />
<View style={{width: 100, height: 100, backgroundColor: 'gray'}} />
<Text style={{color: 'gray'}}>This is RN Text</Text>
<CustomXamlComponentWithNativeLayout
label="This is a Xaml Button set to ellipisify on truncation"
style={{flexShrink: 1}}
/>
<View style={{width: 100, height: 100, backgroundColor: 'green'}} />
<View style={{width: 100, height: 100, backgroundColor: 'red'}} />
<View style={{width: 100, height: 100, backgroundColor: 'blue'}} />
<View style={{width: 100, height: 100, backgroundColor: 'pink'}} />
<View style={{width: 100, height: 100, backgroundColor: 'gray'}} />
</View>
<NativeComponentWithNativeLayout />
);
},
},
}
];
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,43 @@

'use strict';

import React from 'react';
import React, { useState } from 'react';
import {Text, View} from 'react-native';
import CustomXamlComponentWithYogaLayout from './CustomXamlComponentWithYogaLayoutNativeComponent';

const NativeComponentWithYogaExample = () => {
let [log, setLog] = useState('');
return (
<View
style={{
borderRadius: 0,
margin: 10,
borderWidth: 2,
flexWrap: 'wrap',
flexDirection: 'row',
gap: 5,
}}>
<View style={{width: 100, height: 100, backgroundColor: 'green'}} />
<View style={{width: 100, height: 100, backgroundColor: 'red'}} />
<View style={{width: 100, height: 100, backgroundColor: 'blue'}} />
<View style={{width: 100, height: 100, backgroundColor: 'pink'}} />
<View style={{width: 100, height: 100, backgroundColor: 'gray'}} />
<Text style={{color: 'gray'}}>This is RN Text</Text>
<Text style={{color: 'red'}}>{log}</Text>
<CustomXamlComponentWithYogaLayout
label="This is a Xaml Button set to ellipisify on truncation"
style={{flex: 1, minWidth: 100}}
onMyEvent={(arg) => {setLog(log + '\nRecieved MyEvent: ' + JSON.stringify(arg.nativeEvent) + '\n')}}
/>
<View style={{width: 100, height: 100, backgroundColor: 'green'}} />
<View style={{width: 100, height: 100, backgroundColor: 'red'}} />
<View style={{width: 100, height: 100, backgroundColor: 'blue'}} />
<View style={{width: 100, height: 100, backgroundColor: 'pink'}} />
<View style={{width: 100, height: 100, backgroundColor: 'gray'}} />
</View>
);
};

exports.displayName = 'NativeFabricComponentYoga';
exports.framework = 'React';
exports.category = 'UI';
Expand All @@ -27,31 +60,7 @@ exports.examples = [
title: 'Native Component',
render: function (): React.Node {
return (
<View
style={{
borderRadius: 0,
margin: 10,
borderWidth: 2,
flexWrap: 'wrap',
flexDirection: 'row',
gap: 5,
}}>
<View style={{width: 100, height: 100, backgroundColor: 'green'}} />
<View style={{width: 100, height: 100, backgroundColor: 'red'}} />
<View style={{width: 100, height: 100, backgroundColor: 'blue'}} />
<View style={{width: 100, height: 100, backgroundColor: 'pink'}} />
<View style={{width: 100, height: 100, backgroundColor: 'gray'}} />
<Text style={{color: 'gray'}}>This is RN Text</Text>
<CustomXamlComponentWithYogaLayout
label="This is a Xaml Button set to ellipisify on truncation"
style={{flex: 1, minWidth: 100}}
/>
<View style={{width: 100, height: 100, backgroundColor: 'green'}} />
<View style={{width: 100, height: 100, backgroundColor: 'red'}} />
<View style={{width: 100, height: 100, backgroundColor: 'blue'}} />
<View style={{width: 100, height: 100, backgroundColor: 'pink'}} />
<View style={{width: 100, height: 100, backgroundColor: 'gray'}} />
</View>
<NativeComponentWithYogaExample />
);
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9627,6 +9627,7 @@ exports[`Home UIA Tree Dump Search Bar 1`] = `
"IsKeyboardFocusable": true,
"LocalizedControlType": "edit",
"Name": "Search...",
"ValuePattern.IsReadOnly": false,
},
"Component Tree": {
"Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView",
Expand Down
Loading