From fcfde38aaf93a8f854f72aeab932a4163a74a735 Mon Sep 17 00:00:00 2001 From: Samuel Freiberg <32719011+samuelfreiberg@users.noreply.github.com> Date: Wed, 20 Oct 2021 09:02:09 -0700 Subject: [PATCH] Adding ScrollView+Callout Example to Callout Testpage (#882) * Yarn * Merge * Fixing repo * Update package * Merge * Removing change file * Adding callout+Scrollview to callout test page * Cleaning up scrollview usage * Cleaning test file * Adding ability to change anchor * Change files * Integrated ScrollView with standard callout * Fixing callout * Fixing callout --- .../TestComponents/Callout/CalloutTest.tsx | 53 ++++++++++++++++--- .../TestComponents/Common/styles.ts | 15 ++++++ ...-279c241c-c209-4949-9433-f35a2af55074.json | 7 +++ 3 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 change/@fluentui-react-native-tester-279c241c-c209-4949-9433-f35a2af55074.json diff --git a/apps/fluent-tester/src/FluentTester/TestComponents/Callout/CalloutTest.tsx b/apps/fluent-tester/src/FluentTester/TestComponents/Callout/CalloutTest.tsx index c9ee055ad7..435c99c2f2 100644 --- a/apps/fluent-tester/src/FluentTester/TestComponents/Callout/CalloutTest.tsx +++ b/apps/fluent-tester/src/FluentTester/TestComponents/Callout/CalloutTest.tsx @@ -1,8 +1,9 @@ import * as React from 'react'; -import { ScreenRect, Text, View, Switch, Picker } from 'react-native'; -import { Button, Callout, Separator, IFocusable, RestoreFocusEvent, DismissBehaviors } from '@fluentui/react-native'; +import { ScreenRect, Text, View, Switch, Picker, ScrollView } from 'react-native'; +import { Button, Callout, Separator, IFocusable, RestoreFocusEvent, DismissBehaviors, StealthButton } from '@fluentui/react-native'; import { CALLOUT_TESTPAGE } from './consts'; import { Test, TestSection, PlatformStatus } from '../Test'; +import { fluentTesterStyles } from '../Common/styles'; const standardCallout: React.FunctionComponent = () => { const [showStandardCallout, setShowStandardCallout] = React.useState(false); @@ -100,6 +101,19 @@ const standardCallout: React.FunctionComponent = () => { const [selectedBorderWidth, setSelectedBorderWidth] = React.useState(undefined); + const [showScrollViewCallout, setShowScrollViewCalout] = React.useState(false); + const [scrollviewContents, setScrollviewContents] = React.useState([1, 2, 3]); + + const removeButton = React.useCallback(() => { + const tempArray = scrollviewContents; + tempArray.pop(); + setScrollviewContents([...tempArray]); + }, [setScrollviewContents, scrollviewContents]); + + const addButton = React.useCallback(() => { + setScrollviewContents(arr => [...arr, 1]); + }, [setScrollviewContents, scrollviewContents]); + return ( @@ -129,6 +143,11 @@ const standardCallout: React.FunctionComponent = () => { Prevent Dismiss On Click Outside + + + Enable ScrollView Callout + + { ...(selectedBackgroundColor && { backgroundColor: selectedBackgroundColor }), ...(selectedBorderWidth && { borderWidth: selectedBorderWidth }), ...(calloutDismissBehaviors && { dismissBehaviors: calloutDismissBehaviors }), - }} - > - -