From b890ae6fff395d4a627852131f13c611256a4d12 Mon Sep 17 00:00:00 2001
From: Chris Glein <26607885+chrisglein@users.noreply.github.com>
Date: Thu, 30 Mar 2023 17:38:51 -0700
Subject: [PATCH] Add fluent-ui-react-native controls - Allows use of their
Button type - Required importing SVG (see
https://github.com/microsoft/fluentui-react-native/issues/2613) - Which in
turn requires importing the Win2D nuget - Also required switching to classic
runtime (see https://github.com/microsoft/fluentui-react-native/issues/1891)
---
babel.config.js | 3 +-
package.json | 1 +
src/Chat.tsx | 17 ++--
src/Popups.tsx | 14 ++--
src/Settings.tsx | 14 ++--
windows/artificialChat.sln | 14 ++++
.../AutolinkedNativeModules.g.cpp | 5 ++
.../AutolinkedNativeModules.g.targets | 4 +
windows/artificialChat/artificialChat.vcxproj | 8 ++
windows/artificialChat/packages.config | 5 ++
yarn.lock | 84 +++++++++++++++++++
11 files changed, 144 insertions(+), 25 deletions(-)
create mode 100644 windows/artificialChat/packages.config
diff --git a/babel.config.js b/babel.config.js
index f842b77..1be3da9 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -1,3 +1,4 @@
module.exports = {
- presets: ['module:metro-react-native-babel-preset'],
+ presets: [['module:metro-react-native-babel-preset', {useTransformReactJSXExperimental:true}]],
+ plugins: [['@babel/plugin-transform-react-jsx', { runtime: 'classic' }]]
};
diff --git a/package.json b/package.json
index ac19ffa..f3c7bca 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
"react": "18.2.0",
"react-native": "0.71.0",
"react-native-markdown-display": "^7.0.0-alpha.2",
+ "react-native-svg": "^13.9.0",
"react-native-syntax-highlighter": "^2.1.0",
"react-native-windows": "0.71.1"
},
diff --git a/src/Chat.tsx b/src/Chat.tsx
index 4f52245..26ddf0c 100644
--- a/src/Chat.tsx
+++ b/src/Chat.tsx
@@ -1,6 +1,5 @@
import React from 'react';
import {
- Button,
ScrollView,
TextInput,
View,
@@ -15,6 +14,7 @@ import {
} from './Feedback';
import { PopupsContext } from './Popups';
import { HoverButton } from './Controls';
+import { ButtonV1 as Button } from '@fluentui/react-native';
enum ChatSource {
Human,
@@ -86,13 +86,15 @@ function ChatEntry({submit, defaultText, clearConversation}: ChatEntryProps): JS
onSubmitEditing={submitValue}
value={defaultText ?? value}/>
);
}
@@ -170,11 +172,10 @@ function Chat({entries, humanText, onPrompt, clearConversation}: ChatProps): JSX
}
diff --git a/src/Popups.tsx b/src/Popups.tsx
index 3500773..08de172 100644
--- a/src/Popups.tsx
+++ b/src/Popups.tsx
@@ -5,7 +5,7 @@ import {
} from 'react-native';
import {Popup} from 'react-native-windows';
import {StylesContext} from './Styles';
-import { Button, IFocusable } from '@fluentui/react-native';
+import { ButtonV1 as Button } from '@fluentui/react-native';
type PopupsContextType = {
showAbout: boolean,
@@ -32,12 +32,12 @@ type DialogFrameType = PropsWithChildren<{
function DialogFrame({children, show, close, isLightDismissEnabled, titleIcon, titleIconStyle, title, buttons}: DialogFrameType) {
const styles = React.useContext(StylesContext);
- const populatedButtons = buttons ?? [