Skip to content
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
52 changes: 49 additions & 3 deletions FabricExample/src/screens/Examples/Toolbar/index.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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 = {
Expand All @@ -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) => {
Expand Down Expand Up @@ -170,6 +172,44 @@ export default function ToolbarExample() {
);
}

type Props = StackScreenProps<ExamplesStackParamList>;

export default function ToolbarExample({ navigation }: Props) {
const [isVisible, setVisible] = useState(false);

useEffect(() => {
navigation.setOptions({
headerRight: () => (
<View style={styles.row}>
<Text
style={styles.header}
testID="toolbar.kyc"
onPress={() => setVisible(true)}
>
KYC
</Text>
</View>
),
});
}, [navigation]);

return (
<>
<Form />
<Modal
animationType="slide"
presentationStyle="formSheet"
visible={isVisible}
onRequestClose={() => setVisible(false)}
>
<View style={styles.modal}>
<Form />
</View>
</Modal>
</>
);
}

const styles = StyleSheet.create({
container: {
backgroundColor: "white",
Expand All @@ -190,6 +230,12 @@ const styles = StyleSheet.create({
bottom: 0,
right: 0,
},
header: {
marginRight: 12,
},
modal: {
marginTop: 32,
},
});

const blur = (
Expand Down
52 changes: 49 additions & 3 deletions example/src/screens/Examples/Toolbar/index.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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 = {
Expand All @@ -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) => {
Expand Down Expand Up @@ -170,6 +172,44 @@ export default function ToolbarExample() {
);
}

type Props = StackScreenProps<ExamplesStackParamList>;

export default function ToolbarExample({ navigation }: Props) {
const [isVisible, setVisible] = useState(false);

useEffect(() => {
navigation.setOptions({
headerRight: () => (
<View style={styles.row}>
<Text
style={styles.header}
testID="toolbar.kyc"
onPress={() => setVisible(true)}
>
KYC
</Text>
</View>
),
});
}, [navigation]);

return (
<>
<Form />
<Modal
animationType="slide"
presentationStyle="formSheet"
visible={isVisible}
onRequestClose={() => setVisible(false)}
>
<View style={styles.modal}>
<Form />
</View>
</Modal>
</>
);
}

const styles = StyleSheet.create({
container: {
backgroundColor: "white",
Expand All @@ -190,6 +230,12 @@ const styles = StyleSheet.create({
bottom: 0,
right: 0,
},
header: {
marginRight: 12,
},
modal: {
marginTop: 32,
},
});

const blur = (
Expand Down