Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined is not an object #24

Open
MinhMinh8722 opened this issue Nov 15, 2017 · 2 comments
Open

undefined is not an object #24

MinhMinh8722 opened this issue Nov 15, 2017 · 2 comments

Comments

@MinhMinh8722
Copy link

MinhMinh8722 commented Nov 15, 2017

I copied your example into App.js and had an error.
screen shot 2017-11-15 at 09 39 19

Please help me!!!

And this is my code:

import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View
} from 'react-native';
import Swiper from 'react-native-page-swiper'

export default class App extends Component<{}> {
  render() {
    return (
        <Swiper style={styles.wrapper}>
          <View style={styles.slide1}>
            <Text style={styles.text}>Hello Swiper</Text>
          </View>

          <View style={styles.slide2}>
            <Text style={styles.text}>Beautiful</Text>
          </View>

          <View style={styles.slide3}>
            <Text style={styles.text}>And simple</Text>
          </View>
        </Swiper>
    );
  }
}

var styles = StyleSheet.create({
    wrapper: {
    },
    slide1: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#9DD6EB',
    },
    slide2: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#97CAE5',
    },
    slide3: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#92BBD9',
    },
    text: {
        color: '#fff',
        fontSize: 30,
        fontWeight: 'bold',
    }
});
@twavis
Copy link

twavis commented Jan 10, 2018

The version of the code that is posted on npm is dated and doesn't work with later versions of RN. You can install the latest committed code that fixes the issue with npm i github:fixt/react-native-page-swiper#b19964571c7b690c66362d92c1239054fc0546db --save

@QuestInfosense
Copy link

QuestInfosense commented Aug 1, 2018

Please import the PropTypes module. it has been moved to an external package so in order to use PropTypes you'll need to import the package.

sudo npm install prop-types --save
And then reference the package like this

import PropTypes from 'prop-types';
Note : Please remove the outdated package usage. While adding dependencies please make sure that package version is support by the react latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants