React-native-tab-view: node_modules/react-native-tab-view/src/index.js`: The module `./PagerDefault` could not be found from

Created on 24 Feb 2019  路  1Comment  路  Source: satya164/react-native-tab-view


Current behaviour

The module ./PagerDefault from node_modules/react-native-tab-view/src/index.js is not found

Expected behaviour

Code sample

...
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 (
{props.navigationState.routes.map((route, i) => {
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 }}
        />
    );
}

}

Screenshots (if applicable)

What have you tried

Your Environment

| 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",

Most helpful comment

react-native start --reset-cache

>All comments

react-native start --reset-cache

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jasonkw9 picture jasonkw9  路  3Comments

AndriiUhryn picture AndriiUhryn  路  3Comments

nastarfan picture nastarfan  路  3Comments

f6m6 picture f6m6  路  3Comments

hyochan35 picture hyochan35  路  3Comments