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

react 16.0 is not work #112

Open
jiqimaogou opened this issue Nov 9, 2017 · 7 comments
Open

react 16.0 is not work #112

jiqimaogou opened this issue Nov 9, 2017 · 7 comments

Comments

@jiqimaogou
Copy link

react.createclass is undefine.

@patrickmuhi
Copy link

patrickmuhi commented Nov 19, 2017

@jiqimaogou clone the repo, edit it's syntax to react 6, remove react.createclass replacing it with extends Component and binding all functions to this

@104gogo
Copy link

104gogo commented Dec 21, 2017

I change all es5.js -> es6.js, delete isMounted method, and ActivityIndicatorIOS -> ActivityIndicator...
then demo example_advanced is run.
but when I try pull refresh.
...
..
.

@niudong1001
Copy link

I solved those problem by follow steps :

  1. copy GiftedListView.js to my own folder
  2. npm install -save create-react-class && npm install -save react-native-gifted-spinner
  3. add some code at first:
React.PropTypes=require('prop-types');
React.createClass=require('create-react-class');

@saurabhabh
Copy link

Did any one of you got it working by the solution given by @dongniu0927 ? I tried it but facing the issues.

Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

Check the render method of ListView.

@GoldAndLink
Copy link

Actually you can use https://github.com/iwater/react-native-infinite-virtualized-list, an equivalent to /react-native-gifted-listview but with the new react-native/VirtualizedList component, and a drop replacement component of react-native-gifted-listview

@FurshawFu
Copy link

Did any one of you got it working by the solution given by @dongniu0927 ? I tried it but facing the issues.

Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of ListView.

i got the same ,did u fix it?

@sagojez
Copy link

sagojez commented Feb 16, 2019

Hi, I've been trying to solve this issue. I don't know how is the syntax to set an state from a form.
This is my code, no matters what I write on the fields my states UserEmail and UserPassword never changes.

import { View, TouchableHighlight, Text } from 'react-native';
import AppButton from '../Components/AppButton'
import { createStackNavigator, createAppContainer } from "react-navigation";
import t from 'tcomb-form-native'
import FormValidation from '../Utils/Validation'
import { Card } from 'react-native-elements'
import Toast, {DURATION} from 'react-native-easy-toast'



const Form = t.form.Form
const user = t.struct({
  email: FormValidation.email,
  password: FormValidation.password
})
const options = {
  fields: {
    email: {
      help: 'Introduce tu correo',
      error: 'Correo incorrecto',
      autoCapitalize: 'none',
    },
    password:{
      help: 'Introduce tu contraseña',
      error: 'Contraseña incorrecta',
      textContentType: 'password',
      secureTextEntry: true,
    }
  }
}


export default class Login extends Component{
  constructor(){
    super();
    this.state = {
        UserEmail:'Carlos',
        UserPassword:'',
    }
  }
  onChange (UserEmail){
    this.setState({UserEmail});
  }

UserLoginFunction = () =>{
  const { UserEmail }  = this.state ;
  const { UserPassword }  = this.state ;

  fetch('http://localhost:8888/User_Project/user_login.php', {
   method: 'POST',
   headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      email: UserEmail,
      password: UserPassword
    })  
  }).then((response) => response.json())
        .then((responseJson) => {
         if(responseJson === 'Data Matched')
          {
               this.refs.toast.show('Iniciando Sesión',DURATION.LENGTH_LONG);
               //Pendiente enviar a la siguiente actividad
          }
          else{
           this.refs.toast.show(UserEmail,DURATION.LENGTH_LONG);
          }
        }).catch((error) => {
          console.error(error);
         });
     }

  render(){
    return( 
      <View>
        <Card wrapperStyle = {{paddingLeft:10}} title = 'Iniciar Sesión'>
          <Form
            ref = "form"
            type = {user}
            options = {options}
          />
          <AppButton
              bgColor='rgba(58, 227, 116, 0.7)'
              title="Iniciar Sesión"
              action={this.UserLoginFunction}
              value={this.state.value}
              onChange={this.onChange}
          />
           <Toast
                ref="toast"
                style={{backgroundColor:'red'}}
                position='top'
                positionValue={200}
                fadeInDuration={750}
                fadeOutDuration={1000}
                opacity={0.8}
                textStyle={{color:'black'}}
            />     
        </Card>
      </View>
    )
  }
}

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

No branches or pull requests

8 participants