The module ./PagerDefault from node_modules/react-native-tab-view/src/index.js is not found
...
import React from 'react';
import {Text, ScrollView, TouchableOpacity, View, TouchableHighlight, StyleSheet, Image, Dimensions } from 'react-native';
import styles from './styles';
import { TabView, SceneMap } from 'react-native-tab-view';
import Animated from 'react-native-reanimated';
const FirstRoute = () => (
);
const SecondRoute = () => (
);
export default class Home extends React.Component {
constructor(props) {
super(props);
this.state = {
index: 0,
routes: [
{ key: 'first', title: 'First' },
{ key: 'second', title: 'Second' },
],
};
}
_handleIndexChange = index => this.setState({ index });
_renderTabBar = props => {
const inputRange = props.navigationState.routes.map((x, i) => i);
return (
const color = Animated.color(
Animated.round(
Animated.interpolate(props.position, {
inputRange,
outputRange: inputRange.map(
inputIndex => (inputIndex === i ? 255 : 0)
),
})
),
0,
0
);
return (
<TouchableOpacity
style={styles.tabItem}
onPress={() => this.setState({ index: i })}>
<Animated.Text style={{ color }}>{route.title}</Animated.Text>
</TouchableOpacity>
);
})}
</View>
);
};
_renderScene = SceneMap({
first: FirstRoute,
second: SecondRoute,
});
render() {
return (
<TabView
navigationState={this.state}
renderScene={this._renderScene}
renderTabBar={this._renderTabBar}
onIndexChange={this._handleIndexChange}
initialLayout={{ width: Dimensions.get('window').width, height: 40 }}
/>
);
}
}
| software | version
| --------------------- | -------
| "react" | "16.6.3",
|"react-native" | "0.58.4",
|"react-native-reanimated" | "^1.0.0-alpha.12",
|"react-native-tab-view" | "^2.0.0-alpha.4",
react-native start --reset-cache
Most helpful comment
react-native start --reset-cache