diff --git a/FabricExample/src/screens/Examples/Toolbar/index.tsx b/FabricExample/src/screens/Examples/Toolbar/index.tsx index f54d572dfa..f82cf99071 100644 --- a/FabricExample/src/screens/Examples/Toolbar/index.tsx +++ b/FabricExample/src/screens/Examples/Toolbar/index.tsx @@ -1,6 +1,6 @@ import { BlurView } from "@react-native-community/blur"; -import React, { useCallback, useState } from "react"; -import { Platform, StyleSheet, View } from "react-native"; +import React, { useCallback, useEffect, useState } from "react"; +import { Modal, Platform, StyleSheet, Text, View } from "react-native"; import { trigger } from "react-native-haptic-feedback"; import { KeyboardAwareScrollView, @@ -13,6 +13,8 @@ import TextInput from "../../../components/TextInput"; import AutoFillContacts from "./Contacts"; import type { Contact } from "./Contacts"; +import type { ExamplesStackParamList } from "../../../navigation/ExamplesStack"; +import type { StackScreenProps } from "@react-navigation/stack"; // Optional configuration const options = { @@ -22,7 +24,7 @@ const options = { const haptic = () => trigger(Platform.OS === "ios" ? "impactLight" : "keyboardTap", options); -export default function ToolbarExample() { +function Form() { const [showAutoFill, setShowAutoFill] = useState(false); const [name, setName] = useState(""); const onContactSelected = useCallback((contact: Contact) => { @@ -170,6 +172,44 @@ export default function ToolbarExample() { ); } +type Props = StackScreenProps; + +export default function ToolbarExample({ navigation }: Props) { + const [isVisible, setVisible] = useState(false); + + useEffect(() => { + navigation.setOptions({ + headerRight: () => ( + + setVisible(true)} + > + KYC + + + ), + }); + }, [navigation]); + + return ( + <> +
+ setVisible(false)} + > + + + + + + ); +} + const styles = StyleSheet.create({ container: { backgroundColor: "white", @@ -190,6 +230,12 @@ const styles = StyleSheet.create({ bottom: 0, right: 0, }, + header: { + marginRight: 12, + }, + modal: { + marginTop: 32, + }, }); const blur = ( diff --git a/example/src/screens/Examples/Toolbar/index.tsx b/example/src/screens/Examples/Toolbar/index.tsx index f54d572dfa..f82cf99071 100644 --- a/example/src/screens/Examples/Toolbar/index.tsx +++ b/example/src/screens/Examples/Toolbar/index.tsx @@ -1,6 +1,6 @@ import { BlurView } from "@react-native-community/blur"; -import React, { useCallback, useState } from "react"; -import { Platform, StyleSheet, View } from "react-native"; +import React, { useCallback, useEffect, useState } from "react"; +import { Modal, Platform, StyleSheet, Text, View } from "react-native"; import { trigger } from "react-native-haptic-feedback"; import { KeyboardAwareScrollView, @@ -13,6 +13,8 @@ import TextInput from "../../../components/TextInput"; import AutoFillContacts from "./Contacts"; import type { Contact } from "./Contacts"; +import type { ExamplesStackParamList } from "../../../navigation/ExamplesStack"; +import type { StackScreenProps } from "@react-navigation/stack"; // Optional configuration const options = { @@ -22,7 +24,7 @@ const options = { const haptic = () => trigger(Platform.OS === "ios" ? "impactLight" : "keyboardTap", options); -export default function ToolbarExample() { +function Form() { const [showAutoFill, setShowAutoFill] = useState(false); const [name, setName] = useState(""); const onContactSelected = useCallback((contact: Contact) => { @@ -170,6 +172,44 @@ export default function ToolbarExample() { ); } +type Props = StackScreenProps; + +export default function ToolbarExample({ navigation }: Props) { + const [isVisible, setVisible] = useState(false); + + useEffect(() => { + navigation.setOptions({ + headerRight: () => ( + + setVisible(true)} + > + KYC + + + ), + }); + }, [navigation]); + + return ( + <> + + setVisible(false)} + > + + + + + + ); +} + const styles = StyleSheet.create({ container: { backgroundColor: "white", @@ -190,6 +230,12 @@ const styles = StyleSheet.create({ bottom: 0, right: 0, }, + header: { + marginRight: 12, + }, + modal: { + marginTop: 32, + }, }); const blur = (