Skip to content

Commit 0c27306

Browse files
febobofebobo
authored andcommitted
reply ctrl
1 parent 8b3ecc4 commit 0c27306

File tree

6 files changed

+21
-3
lines changed

6 files changed

+21
-3
lines changed

ios/FeInn/AppDelegate.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3131
* on the same Wi-Fi network.
3232
*/
3333

34-
jsCodeLocation = [NSURL URLWithString:@"http://192.168.1.83:8081/index.ios.bundle?platform=ios&dev=true"];
34+
jsCodeLocation = [NSURL URLWithString:@"http://192.168.1.41:8081/index.ios.bundle?platform=ios&dev=true"];
3535

3636
/**
3737
* OPTION 2

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"dependencies": {
99
"flux-standard-action": "^0.6.1",
1010
"lodash": "^4.13.1",
11+
"markdown": "^0.5.0",
1112
"moment": "^2.13.0",
1213
"mrn": "^0.1.7",
1314
"react": "^0.14.8",

src/actions/CommentActions.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as types from './actionTypes';
22
import * as topicService from '../service/topicService';
33
import {createAction} from 'redux-actions';
4+
import markdown from 'markdown'
45

56
export const replyTopicById = createAction(types.REPLY_TOPIC , topicService.reply , ({
67
topicId,
@@ -9,6 +10,7 @@ export const replyTopicById = createAction(types.REPLY_TOPIC , topicService.repl
910
user
1011
} , resolved , rejected) => {
1112
console.log(resolved)
13+
resolved();
1214
return {
1315
}
1416
})

src/config/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export default {
2-
domain : 'https://cnodejs.org/api/v1'
2+
domain : 'https://cnodejs.org/api/v1',
3+
replySuffix: '\nFrom [变异后的 CNode+](https://github.com/febobo/react-native-redux-FeInn)',
34
}

src/page/Comment.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import * as DetailActions from '../actions/DetailActions';
2121
import { connect } from 'react-redux';
2222
import TabShow from '../components/TabShow';
2323
import connectComponent from '../utils/connectComponent';
24+
import config from '../config';
2425

2526
let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2})
2627

@@ -56,14 +57,26 @@ class Comment extends Component {
5657
console.log(this)
5758
actions.replyTopicById({
5859
topicId: Detail.data.id,
59-
content: '21212',
60+
content: this.textInputValue + config.replySuffix,
6061
// replyId: this.replyId,
6162
user: {
6263
loginname: '212',
6364
avatar_url: '2212'
6465
}
66+
},()=>{
67+
this._resetReplyForm()
6568
})
6669
}
70+
71+
_resetReplyForm() {
72+
this.replyId = null;
73+
this.textInput.setNativeProps({
74+
text: ''
75+
});
76+
this.textInputValue = '';
77+
this.textInput.blur();
78+
}
79+
6780
componentUnMount(){
6881
this.keyboardWillHideEvent.remove()
6982
this.keyboardWillShowEvent.remove()

src/service/topicService.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as requestService from './requestService';
22
import {getToken, setToken} from './tokenService';
33

44
export function reply({topicId , content , replyId}){
5+
console.log(arguments)
56
let body = {
67
accesstoken : getToken() || '89f37401-8659-4535-9f16-b31068495928',
78
content

0 commit comments

Comments
 (0)