|
@@ -2,11 +2,15 @@
|
|
|
import React, { Component } from 'react';
|
|
|
import { View, Text, DeviceEventEmitter, Button } from 'react-native';
|
|
|
// import EventEmitter from 'react-native-eventemitter';
|
|
|
+import { DenetWebview } from '@/components/webview';
|
|
|
+import { guid } from '@/utils/';
|
|
|
+import messageCenter from '@/utils/messageCenter';
|
|
|
|
|
|
interface Props {
|
|
|
route: any;
|
|
|
}
|
|
|
class Redpack extends Component<Props> {
|
|
|
+ webref = {} as any;
|
|
|
favoriteTweet = () => {
|
|
|
const idArray = this.props.route.params.tweet_Id.split('');
|
|
|
console.log(idArray);
|
|
@@ -17,13 +21,27 @@ class Redpack extends Component<Props> {
|
|
|
id2: idArray.join(''),
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
+ onMessageHandle = (messageData: any) => {
|
|
|
+ let { info, data } =
|
|
|
+ (messageData.nativeEvent.data &&
|
|
|
+ JSON.parse(messageData.nativeEvent.data)) ||
|
|
|
+ {};
|
|
|
+ console.log('onMessageHandle', info, data);
|
|
|
+ info.target = this.webref;
|
|
|
+ messageCenter.send({ info, data });
|
|
|
+ };
|
|
|
+
|
|
|
componentDidMount() {
|
|
|
// this.TwitterLikeAPI();
|
|
|
}
|
|
|
render() {
|
|
|
+ const { tweet_Id, post_Id, invite_code, ct0, page_type } =
|
|
|
+ this.props.route.params;
|
|
|
+ const iframe_id = `denet-${guid()}`;
|
|
|
return (
|
|
|
<View style={{ flex: 1 }}>
|
|
|
- <Text>tweet_Id: {this.props.route.params.tweet_Id}</Text>
|
|
|
+ {/* <Text>tweet_Id: {this.props.route.params.tweet_Id}</Text>
|
|
|
<Text>post_Id: {this.props.route.params.post_Id}</Text>
|
|
|
<Text>invite_code: {this.props.route.params.invite_code}</Text>
|
|
|
<Text>ct0: {this.props.route.params.ct0}</Text>
|
|
@@ -32,6 +50,13 @@ class Redpack extends Component<Props> {
|
|
|
title="FavoriteTweet"
|
|
|
color="#841584"
|
|
|
accessibilityLabel="FavoriteTweet when click"
|
|
|
+ /> */}
|
|
|
+ <DenetWebview
|
|
|
+ onLoadEndHandle={() => {}}
|
|
|
+ refHandle={r => (this.webref = r)}
|
|
|
+ onMessageHandle={this.onMessageHandle}
|
|
|
+ handleWebViewNavigationStateChange={() => {}}
|
|
|
+ uri={`http://localhost:3001/red-pack?postId=${post_Id}&tweetId=${tweet_Id}&tweet_author=&window_origin=https://twitter.com&page_type=${page_type}&iframeId=${iframe_id}&appVersionCode=22`}
|
|
|
/>
|
|
|
</View>
|
|
|
);
|