0
import React, { Component } from 'react';
import {
    AppRegistry,
  StyleSheet,
  Text,
  View,
  TouchableHighlight
} from 'react-native';

import Button from '@remobile/react-native-simple-button';
import ImagePicker from '@remobile/react-native-image-picker';
import Dialogs from '@remobile/react-native-dialogs';

class cordovaReactImagePicker extends Component{
    onOpen() {
        var options = {maximumImagesCount: 10, width: 400};
        ImagePicker.getPictures(options, function(results) {
            var msg = '';
            for (var i = 0; i < results.length; i++) {
                msg += 'Image URI: ' + results[i] + '\n';
            }
            Dialogs.alert(msg);
        }, function (error) {
            Dialogs.alert('Error: ' + error);
        });
    }
    render() {
        return (
            <View style={styles.container}>
                <Button onPress={this.onOpen}>Photo</Button>
            </View>
        );
    }

};


var styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: 'transparent',
    },
});

AppRegistry.registerComponent('cordovaReactImagePicker', () => cordovaReactImagePicker);

I keep getting error on "seems you are trying to access 'Reactnative.createClass' from the 'react-native' package. Can somebody guide me how should I do it from my understanding is it because the react native sdk syntax code has changed thats why it cannot understand the old code syntax? any help will be greatly appreciate

user3711175
  • 109
  • 2
  • 16

1 Answers1

1

Your react-native version is latest as compared to the third party library you are using, so this error occurs as third party library is made from older syntax of react native. so if your thirdparty library is not so much complex than you can go for it in node-modules folder and changed React.createclass to latest syntax otherwise your thirdparty library should be updated by the specific owner of library

If you really want to use that library you could also use a old version of RN in your project https://stackoverflow.com/a/37623531/1868008

Community
  • 1
  • 1
Chiranjhivi Ghimire
  • 1,739
  • 1
  • 19
  • 21
  • I see thanks for your info I will try later but if is the latest react native version how should I write the react native syntax code then to make it to work? – user3711175 Jun 23 '16 at 06:03
  • you should change some syntax on some library files on node_modules folder else you should create an open issue to update library in specific library git address. – Chiranjhivi Ghimire Jun 23 '16 at 06:22
  • i see thanks for the information Susyl really thanks vry much :) – user3711175 Jun 23 '16 at 06:49