7

I got this error when i am implementing third party library as https://github.com/ayoubdev/react-native-android-kit what this error indicates?

 'use strict';

import React, {Component} from 'react';
import{
 Platform,
 StyleSheet,
 Text,
 View,
 Image,
 Navigator,
 ToolbarAndroid,
 ScrollView
}from 'react-native';

import EventList from './javra-event-list';
  import AndroidToolBar from './javra-android-toolbar';
 import JResource from '../../javra-resource';
 import ScrollableTabView, {DefaultTabBar,ScrollableTabBar} from 'react-native-scrollable-tab-view';
  import CustomTab1 from './javra-custom-tabbar';


 import {TabLayoutAndroid, TabAndroid} from "react-native-android-kit";

 export default class Home extends Component{

  constructor(props){
  super(props);
  this.eventThumnailHandler = this.eventThumnailHandler.bind(this);
  this.movies = [{id:1,title:'Event 2016'},{id:2,title:'Event 2015'},{id:3,title:'Event 2014'},{id:4,title:'Event 2013'},
                {id:5,title:'Event 2016'},{id:6,title:'Event 2015'},{id:7,title:'Event 2014'},{id:8,title:'Event 2013'}
              ];

 }

 static childContextTypes = {
   eventThumnailHandler: React.PropTypes.func.isRequired,

 };

 getChildContext() {
   return {
     eventThumnailHandler: (item) => (this.eventThumnailHandler(item)),

   };
   }

 static contextTypes = {
    openDrawer: React.PropTypes.func.isRequired,
  };

  _openDrawer(){
    this.context.openDrawer();
  }


  eventThumnailHandler(item: Object){
    console.log('*/*/*/*///*/*/: ' + item.title);
    this.props.navigator.push(
      {id: 'NewView' , index:1}
    )
  }

render(){
 var toolbarActions = [{title:'Next',show:'always'}];
 return(
  <View style={{flex:1}}>

                <TabLayoutAndroid style={{height:60}} backgroundColor='#009688' indicatorTabColor='#ffc400'
                                  indicatorTabHeight={2} scrollable={false} center={false}>

                    <TabAndroid text='Tab1' textSize={16} textColor="white" selectedTextColor='#ffc400'
                                icon='ic_home_black_24dp' iconPosition='left'>

                        <Text>I'm the first Tab content!</Text>

                    </TabAndroid>

                    <TabAndroid text='Tab2' textSize={16} textColor='white' selectedTextColor='#ffc400'
                                icon='ic_important_devices_black_24dp' iconPosition='left'>

                        <Text>I'm the second Tab content!</Text>

                    </TabAndroid>

                </TabLayoutAndroid>

            </View>
);
}
}

i have implemented tablayout as provided by the link above mentioned. what could be the error in my file.please suggest me.

3
  • it sounds like React is undefined. You'll have to post some code examples in order to help figure out what's wrong. Commented Jun 10, 2016 at 12:15
  • 1
    Have u upgraded your react-native recently? I had this issue when i upgraded it. Which version are u using? Commented Jun 10, 2016 at 13:30
  • @BigPun86 yes i have upgraded react-native. i have 26.0 version. How you solved this problem? can you suggest me? Commented Jun 13, 2016 at 3:59

4 Answers 4

8
import React, { Component, PropTypes } from 'react';
import {
  StyleSheet,
  Text,
  TouchableOpacity,
  View
} from 'react-native';

Including PropTypes next to component helped me

Sign up to request clarification or add additional context in comments.

1 Comment

To elaborate on this, the newer versions of React Native removed PropTypes and Component` from react-native and are now part of the base React package: Before: import React, { Component, PropTypes, View, Text } from 'react-native'; Now: import React, { Component, PropTypes } from 'react'; import { View, Text } from 'react-native';
3

like this : import PropTypes from 'prop-types';

注:reactVersion:0.51

3 Comments

Thank you, this solution should be marked as default. I'm using react native version 0.62.2 and importing this way do the job.
@Arsen Khachaturyan, can you tell me where do you put that line import PropTypes from 'prop-types'; ?
@AfifaKhan I've put it after the declaration of import { View, Text ... } from 'react-native'. Just note that as a builder I'm using Expo (docs.expo.io/versions/latest/guides/using-clojurescript/…)
1

try running

npm outdated

and update the third-party modules that are not at the current version.

I had to do the same after upgrading React Native and uninstall and re-install some modules.

Comments

0

node-modules->react-native-prompt->propmt.js

old : import React, { Component,PropTypes } from 'react';

new:------

import PropTypes from "prop-types" import React, { Component, } from 'react';

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.