({
navigationState,
position,
}: {
navigationState: State;
position: Animated.AnimatedInterpolation<number>;
})
| 39 | |
| 40 | const renderItem = |
| 41 | ({ |
| 42 | navigationState, |
| 43 | position, |
| 44 | }: { |
| 45 | navigationState: State; |
| 46 | position: Animated.AnimatedInterpolation<number>; |
| 47 | }) => |
| 48 | ({ route, index }: { route: Route; index: number }) => { |
| 49 | const inputRange = navigationState.routes.map((_, i) => i); |
| 50 | |
| 51 | const activeOpacity = position.interpolate({ |
| 52 | inputRange, |
| 53 | outputRange: inputRange.map((i: number) => (i === index ? 1 : 0)), |
| 54 | }); |
| 55 | const inactiveOpacity = position.interpolate({ |
| 56 | inputRange, |
| 57 | outputRange: inputRange.map((i: number) => (i === index ? 0 : 1)), |
| 58 | }); |
| 59 | |
| 60 | return ( |
| 61 | <View style={styles.tab}> |
| 62 | <Animated.View style={[styles.item, { opacity: inactiveOpacity }]}> |
| 63 | <View style={[styles.icon]} /> |
| 64 | <Text style={[styles.label, styles.inactive]}>{route.title}</Text> |
| 65 | </Animated.View> |
| 66 | <Animated.View |
| 67 | style={[styles.item, styles.activeItem, { opacity: activeOpacity }]} |
| 68 | > |
| 69 | <View style={[styles.icon]} /> |
| 70 | <Text style={[styles.label, styles.active]}>{route.title}</Text> |
| 71 | </Animated.View> |
| 72 | </View> |
| 73 | ); |
| 74 | }; |
| 75 | |
| 76 | const renderTabBar = ( |
| 77 | props: SceneRendererProps & { navigationState: State } |
no outgoing calls
no test coverage detected
searching dependent graphs…