react-native-gifted-listview icon indicating copy to clipboard operation
react-native-gifted-listview copied to clipboard

react 16.0 is not work

Open jiqimaogou opened this issue 7 years ago • 7 comments

react.createclass is undefine.

jiqimaogou avatar Nov 09 '17 09:11 jiqimaogou

@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

patrickmuhi avatar Nov 19 '17 21:11 patrickmuhi

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. ... .. .

104gogo avatar Dec 21 '17 12:12 104gogo

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');

niudong1001 avatar Feb 28 '18 06:02 niudong1001

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.

saurabhabh avatar Jun 01 '18 08:06 saurabhabh

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

GoldAndLink avatar Aug 26 '18 13:08 GoldAndLink

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?

FurshawFu avatar Oct 28 '18 06:10 FurshawFu

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>
    )
  }
}

sagoez avatar Feb 16 '19 21:02 sagoez