Skip to content

Instantly share code, notes, and snippets.

const FirstRoute = () => (
<View
style={{
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.64)',
justifyContent: 'center',
alignItems: 'center',
}}>
<Text style={{color: 'white', fontSize: 24}}>First page</Text>
</View>
import React, {useEffect} from 'react';
import {Animated, StyleSheet} from 'react-native';
import ReAnimated, {
interpolate,
useAnimatedStyle,
useSharedValue,
} from 'react-native-reanimated';
import {NavigationState, Route} from 'react-native-tab-view';
import {Measure} from './types';
import React, {useEffect, useMemo, useRef, useState} from 'react';
import {TabViewProps, Route} from 'react-native-tab-view';
import {View} from 'react-native';
import {TabBarItem} from './TabBarItem';
import {Measure} from './types';
import {TabBarIndicator} from './TabBarIndicator';
type Props<T extends Route> = Parameters<
NonNullable<TabViewProps<T>['renderTabBar']>
>[0] & {
import React, {forwardRef, useCallback} from 'react';
import {TouchableOpacity, Animated, View} from 'react-native';
type Props = {
onPress: (index: number) => void;
index: number;
opacity: Animated.AnimatedInterpolation;
ref: React.RefObject<any>;
children: React.ReactNode;
};
import React from 'react';
import {TabViewProps, Route} from 'react-native-tab-view';
import {View} from 'react-native';
import {TabBarItem} from './TabBarItem';
type Props<T extends Route> = Parameters<
NonNullable<TabViewProps<T>['renderTabBar']>
>[0] & {
onIndexChange: (index: number) => void;
};
const FirstRoute = () => (
<View
style={{
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.64)',
justifyContent: 'center',
alignItems: 'center',
}}>
<Text style={{color: 'white', fontSize: 24}}>First page</Text>
</View>
const App = () => {
const isDarkMode = useColorScheme() === 'dark';
const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
const [index, setIndex] = useState(0);
const [routes] = useState<TabViewRoute[]>(
tabRoutes as unknown as TabViewRoute[],
import React, {forwardRef, useCallback} from 'react';
import {TouchableOpacity, Animated, View} from 'react-native';
type Props = {
onPress: (index: number) => void;
index: number;
ref: React.RefObject<any>;
children: React.ReactNode;
};
import React from 'react';
import {TabViewProps, Route} from 'react-native-tab-view';
import {View} from 'react-native';
import {TabBarItem} from './TabBarItem';
type Props<T extends Route> = Parameters<
NonNullable<TabViewProps<T>['renderTabBar']>
>[0] & {
onIndexChange: (index: number) => void;
};
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* Generated with the TypeScript template
* https://github.com/react-native-community/react-native-template-typescript
*
* @format
*/