3 Star 0 Fork 0

dsoft / shequnsiweiapp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.ios.js_zhifu 2.50 KB
一键复制 编辑 原始数据 按行查看 历史
dsoft 提交于 2017-11-25 12:28 . 聊天开发
/**
* @flow
*/
import React from 'react';
import {
AppRegistry
, TouchableHighlight,
TouchableNativeFeedback,
Text,
StyleSheet,
ScrollView,
} from 'react-native';
import App from './src/index'
let index = 5;
import { GiftedChat } from 'react-native-gifted-chat';
import MessageInputPanel from './src/core/component-biz/comp.message-input-panel2.js';
import Http from './src/core/utils/http.js';
import Alipay from 'react-native-yunpeng-alipay'
class Example extends React.Component {
state = {
messages: [],
};
componentDidMount() {
Http.alipay(1,'产品1',0.1,(data)=>{alert('支付成功')},(error)=>{
alert(error);
})
}
onSend(messages = []) {
this.setState((previousState) => ({
messages: GiftedChat.append(previousState.messages, messages),
}));
}
onLoadEarlier() {
index = index + 2;
let messages = [
{
_id: index + 1,
text: '历史消息' + (index + 1),
createdAt: new Date(Date.UTC(2016, 5, 11, 17, 19, 0)),
user: {
_id: 3,
name: 'React Native',
avatar: 'http://106.3.143.248/media/237.jpg',
},
},
{
_id: index + 2,
text: '历史消息' + (index + 2),
createdAt: new Date(Date.UTC(2016, 5, 11, 17, 18, 0)),
user: {
_id: 4,
name: 'React Native',
avatar: 'http://106.3.143.248/media/237.jpg',
},
},
];
this.setState((previousState) => ({
messages: GiftedChat.prepend(previousState.messages, messages),
}));
}
/**点击人员头像.*/
onPressAvatar() {
}
renderInputToolbar() {
return <MessageInputPanel />;
}
render() {
return (
<GiftedChat
messages={this.state.messages}
placeholder={'请输入消息'}
loadEarlier={true}
onLoadEarlier={this.onLoadEarlier.bind(this)}
isLoadingEarlier={false}
label={'查看更多'}
timeFormat={'HH:mm'}
dateFormat={'YYYY-MM-DD'}
onSend={(messages) => this.onSend(messages)}
onPressAvatar={this.onPressAvatar}
primaryStyle={styles.primaryStyle}
user={{
_id: 1,
name: 'React Native',
avatar: 'http://106.3.143.248/media/237.jpg',
}}
/>
);
}
}
AppRegistry.registerComponent('shequnsiweiapp', () => Example);
const styles = StyleSheet.create({
container: {
flex: 1,
},
primaryStyle: {
backgroundColor: "#F5F5F7",
},
containerStyle: {
}
});
JavaScript
1
https://gitee.com/dsoft_company_admin/shequnsiweiapp.git
git@gitee.com:dsoft_company_admin/shequnsiweiapp.git
dsoft_company_admin
shequnsiweiapp
shequnsiweiapp
master

搜索帮助