diff --git a/example/index.tsx b/example/index.tsx index 823a9f4..e4fd8d4 100644 --- a/example/index.tsx +++ b/example/index.tsx @@ -25,6 +25,12 @@ Navigation.registerComponent('Home', () => gestureHandlerRootHOC(App), () => App Navigation.registerComponent('Media', () => gestureHandlerRootHOC(Media), () => Media); Navigation.registerComponent('Settings', () => gestureHandlerRootHOC(Settings), () => Settings); +Navigation.events().registerNavigationButtonPressedListener((event) => { + if (event.buttonId === "back") { + Navigation.pop(event.componentId); + } +}); + Navigation.events().registerAppLaunchedListener(async () => { const [cameraPermission, microphonePermission] = await Promise.all([ Camera.getCameraPermissionStatus(), diff --git a/example/src/App.tsx b/example/src/App.tsx index f2c6fd5..3bab79d 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -171,6 +171,9 @@ export const App: NavigationFunctionComponent = ({ componentId }) => { const onNightModePressed = useCallback(() => { setEnableNightMode((n) => !n); }, []); + const onSettingsPressed = useCallback(() => { + Navigation.push(componentId, { component: { name: 'Settings' } }) + }, [componentId]); //#endregion //#region Tap Gesture @@ -245,6 +248,13 @@ export const App: NavigationFunctionComponent = ({ componentId }) => { }); //#endregion + if (device != null && format != null) { + console.log(`Re-rendering camera page with ${isActive ? "active" : "inactive"} camera. ` + + `Device: "${device.name}" (${format.photoWidth}x${format.photoHeight} @ ${fps}fps)`); + } else { + console.log(`re-rendering camera page without active camera`); + } + // TODO: Implement camera flipping (back <-> front) while recording and stich the videos together // TODO: iOS: Use custom video data stream output to manually process the data and write the MOV/MP4 for more customizability. return ( @@ -255,24 +265,24 @@ export const App: NavigationFunctionComponent = ({ componentId }) => { - - animatedProps={cameraAnimatedProps} - /> + + animatedProps={cameraAnimatedProps} + /> @@ -336,6 +346,13 @@ export const App: NavigationFunctionComponent = ({ componentId }) => { /> )} + + + ); diff --git a/example/src/Settings.tsx b/example/src/Settings.tsx index 73af43b..6696b34 100644 --- a/example/src/Settings.tsx +++ b/example/src/Settings.tsx @@ -1,16 +1,36 @@ -import React from 'react'; +import React, { useCallback } from 'react'; -import { StyleSheet, View, Text } from 'react-native'; +import { StyleSheet, View, Text, Linking } from 'react-native'; import type { NavigationFunctionComponent } from 'react-native-navigation'; -export const Settings: NavigationFunctionComponent = ({ componentId }) => { + +export const Settings: NavigationFunctionComponent = () => { + const onCuventPressed = useCallback(() => { + Linking.openURL('https://cuvent.com') + }, []); + return ( - powered by Cuvent + Vision Camera is powered by{" "} + Cuvent. + ); } +Settings.options = { + topBar: { + visible: true, + title: { + text: 'Settings' + }, + backButton: { + id: 'back', + showTitle: true, + } + } +} + const styles = StyleSheet.create({ container: { flex: 1, @@ -18,9 +38,15 @@ const styles = StyleSheet.create({ justifyContent: 'center', backgroundColor: 'white', }, - box: { - width: 60, - height: 60, - marginVertical: 20, + aboutText: { + fontSize: 14, + fontWeight: 'bold', + color: '#A9A9A9', + maxWidth: '50%', + textAlign: 'center', + }, + hyperlink: { + color: '#007aff', + fontWeight: 'bold', }, });