import * as React from 'react'; import { StyleSheet, View, Text, TouchableOpacity, SafeAreaView } from 'react-native'; import { RouteViewPortal } from 'react-native-ios-navigator'; import * as Colors from '../constants/Colors'; export function RouteViewPortalExample01(){ const [index, setIndex] = React.useState(0); return ( ( { // Reset the index when pressed setIndex(0); }} > {routeOptions.routeTitle ?? 'N/A'} )} // Use a custom component for navigation bar right item renderNavBarRightItem={() => ( { // Decrement the index when pressed setIndex(prevIndex => (prevIndex - 1)); }} > {`--`} { // Increment the index when pressed setIndex(prevIndex => (prevIndex + 1)); }} > {`++`} )} /> {`Current Index: ${index}`} ); }; const styles = StyleSheet.create({ routeContainer: { flex: 1, }, rootContainer: { flex: 1, alignItems: 'center', padding: 15, }, textTitle: { fontSize: 24, fontWeight: 'bold', color: Colors.RED.A700, textDecorationLine: 'underline', textDecorationColor: Colors.RED[900], }, navBarLeftItemContainer: { flexDirection: 'row', }, buttonRightSpace: { marginRight: 10, }, buttonContainer: { paddingHorizontal: 10, paddingVertical: 5, borderRadius: 10, backgroundColor: Colors.RED[100], }, buttonLabel: { color: Colors.RED[800], fontWeight: 'bold', }, });