MCPcopy Index your code
hub / github.com/callstack/react-native-paper / DrawerItems

Function DrawerItems

example/src/DrawerItems.tsx:92–293  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90];
91
92function DrawerItems() {
93 const [drawerItemIndex, setDrawerItemIndex] = React.useState<number>(0);
94 const [showRTLDialog, setShowRTLDialog] = React.useState(false);
95 const preferences = React.useContext(PreferencesContext);
96
97 const _setDrawerItem = (index: number) => setDrawerItemIndex(index);
98
99 const { isV3, colors } = useExampleTheme();
100 const isIOS = Platform.OS === 'ios';
101 const expoGoExecution =
102 Constants.executionEnvironment === ExecutionEnvironment.StoreClient;
103
104 if (!preferences) throw new Error('PreferencesContext not provided');
105
106 const {
107 toggleShouldUseDeviceColors,
108 toggleTheme,
109 toggleRtl: toggleRTL,
110 toggleThemeVersion,
111 toggleCollapsed,
112 toggleCustomFont,
113 toggleRippleEffect,
114 customFontLoaded,
115 rippleEffectEnabled,
116 collapsed,
117 rtl: isRTL,
118 theme: { dark: isDarkTheme },
119 shouldUseDeviceColors,
120 } = preferences;
121
122 const _handleToggleRTL = () => {
123 if (expoGoExecution) {
124 setShowRTLDialog(true);
125 return;
126 }
127
128 toggleRTL();
129 I18nManager.forceRTL(!isRTL);
130 if (isWeb) {
131 Updates.reloadAsync();
132 }
133 };
134
135 const _handleDismissRTLDialog = () => {
136 setShowRTLDialog(false);
137 };
138
139 const coloredLabelTheme = {
140 colors: isV3
141 ? {
142 secondaryContainer: MD3Colors.tertiary80,
143 onSecondaryContainer: MD3Colors.tertiary20,
144 }
145 : {
146 primary: MD2Colors.tealA200,
147 },
148 };
149

Callers

nothing calls this directly

Calls 2

useExampleThemeFunction · 0.90
_setDrawerItemFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…