react-native-gifted-listview
react-native-gifted-listview copied to clipboard
react 16.0 is not work
react.createclass is undefine.
@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
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. ... .. .
I solved those problem by follow steps :
- copy
GiftedListView.js
to my own folder - npm install -save create-react-class && npm install -save react-native-gifted-spinner
- add some code at first:
React.PropTypes=require('prop-types');
React.createClass=require('create-react-class');
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
.
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
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?
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>
)
}
}