Permalink
Browse files

init

  • Loading branch information...
0 parents commit 3acdc3c7e8eb8127780824e0e85fed66a9e7f31e @soliury committed Jul 7, 2015
Showing with 78,119 additions and 0 deletions.
  1. +33 −0 .flowconfig
  2. +35 −0 .gitignore
  3. +4 −0 Podfile
  4. +77 −0 README.md
  5. +214 −0 app/components/comment/commentListView.js
  6. 0 app/components/comment/commentRow.js
  7. +25 −0 app/components/comment/commentUp.js
  8. +41 −0 app/components/coverImage.js
  9. +179 −0 app/components/htmlRender/commentHtml.js
  10. +88 −0 app/components/htmlRender/htmlContent.js
  11. +398 −0 app/components/htmlRender/htmlRender.js
  12. +150 −0 app/components/likeIcon.js
  13. +226 −0 app/components/login.js
  14. +276 −0 app/components/messageListView.js
  15. +95 −0 app/components/overlay/commentOverlay.js
  16. +84 −0 app/components/overlay/markAsReadOverlay.js
  17. +148 −0 app/components/overlay/messageOverlay.js
  18. +57 −0 app/components/overlay/overlayButton.js
  19. +60 −0 app/components/overlay/return.js
  20. +71 −0 app/components/overlay/userOverlay.js
  21. +270 −0 app/components/pageListView.js
  22. +176 −0 app/components/pageNavBar.js
  23. +78 −0 app/components/pageScrollView.js
  24. +106 −0 app/components/topicRow.js
  25. +150 −0 app/components/topicsInTab.js
  26. +123 −0 app/components/userTopicPage.js
  27. +6 −0 app/config.js
  28. +9 −0 app/config/onRun.js
  29. +76 −0 app/config/routes.js
  30. +21 −0 app/config/sceneConfig.js
  31. +128 −0 app/mock/topic.js
  32. +372 −0 app/mock/userInfo.js
  33. +28 −0 app/sass/_vars.scss
  34. +12 −0 app/sass/coverImage.scss
  35. +13 −0 app/sass/home.scss
  36. +65 −0 app/sass/pageListView.scss
  37. +41 −0 app/sass/pageNavBar.scss
  38. 0 app/sass/topic.scss
  39. +704 −0 app/scene/comments.js
  40. +212 −0 app/scene/home.js
  41. +269 −0 app/scene/message.js
  42. +172 −0 app/scene/qrCode.js
  43. +335 −0 app/scene/topic.js
  44. +218 −0 app/scene/user.js
  45. +44 −0 app/services/messageService.js
  46. +29 −0 app/services/request.js
  47. +94 −0 app/services/topicService.js
  48. +89 −0 app/services/userService.js
  49. +11 −0 app/styles/coverImage.js
  50. +9 −0 app/styles/home.js
  51. +72 −0 app/styles/pageListView.js
  52. +38 −0 app/styles/pageNavBar.js
  53. +1 −0 app/styles/topic.js
  54. +36 −0 app/util/animation.js
  55. +16 −0 app/util/genColor.js
  56. +114 −0 app/util/htmlParse.js
  57. +7,582 −0 app/util/htmlparser2.js
  58. +25 −0 app/util/storage.js
  59. +30 −0 app/util/window.js
  60. +53 −0 gulpFile.coffee
  61. +16 −0 iOS/AppDelegate.h
  62. +60 −0 iOS/AppDelegate.m
  63. +42 −0 iOS/Base.lproj/LaunchScreen.xib
  64. +38 −0 iOS/Images.xcassets/AppIcon.appiconset/Contents.json
  65. +23 −0 iOS/Images.xcassets/bg2.imageset/Contents.json
  66. BIN iOS/Images.xcassets/bg2.imageset/bg2@1x.jpg
  67. BIN iOS/Images.xcassets/bg2.imageset/bg2@2x.jpg
  68. BIN iOS/Images.xcassets/bg2.imageset/bg2@3x.jpg
  69. +42 −0 iOS/Info.plist
  70. +62,425 −0 iOS/main.jsbundle
  71. +18 −0 iOS/main.m
  72. +89 −0 index.ios.js
  73. +1,042 −0 noder.xcodeproj/project.pbxproj
  74. +112 −0 noder.xcodeproj/xcshareddata/xcschemes/noder.xcscheme
  75. +24 −0 noderTests/Info.plist
  76. +68 −0 noderTests/noderTests.m
  77. +32 −0 package.json
@@ -0,0 +1,33 @@
+[ignore]
+
+# We fork some components by platform.
+.*/*.web.js
+.*/*.android.js
+
+# Some modules have their own node_modules with overlap
+.*/node_modules/node-haste/.*
+
+# Ignore react-tools where there are overlaps, but don't ignore anything that
+# react-native relies on
+.*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js
+.*/node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js
+.*/node_modules/react-tools/src/browser/ui/React.js
+.*/node_modules/react-tools/src/core/ReactInstanceHandles.js
+.*/node_modules/react-tools/src/event/EventPropagators.js
+
+# Ignore commoner tests
+.*/node_modules/react-tools/node_modules/commoner/test/.*
+
+# See https://github.com/facebook/flow/issues/442
+.*/react-tools/node_modules/commoner/lib/reader.js
+
+# Ignore jest
+.*/react-native/node_modules/jest-cli/.*
+
+[include]
+
+[libs]
+node_modules/react-native/Libraries/react-native/react-native-interface.js
+
+[options]
+module.system=haste
@@ -0,0 +1,35 @@
+# OSX
+#
+.DS_Store
+
+# Xcode
+#
+build/
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+xcuserdata
+*.xccheckout
+*.moved-aside
+DerivedData
+*.hmap
+*.ipa
+*.xcuserstate
+project.xcworkspace
+
+# node.js
+#
+node_modules/
+npm-debug.log
+
+.idea
+
+app/mock/user.js
+
+react-packager-cache**
+
@@ -0,0 +1,4 @@
+#<React-Native>
+pod 'React', :path => 'node_modules/react-native'
+
+#</React-Native>
@@ -0,0 +1,77 @@
+# Noder - A React-Native Client for [cnodejs.org](http://cnodejs.org)
+
+
+> A new [cnodejs.org](http://cnodejs.org) mobile app powered by [React-Native](http://facebook.github.io/react-native/).
+
+
+## Develop
+
+If you want to run it on you local simulator, you should:
+
+```
+git clone https://github.com/soliury/noder-react-native.git
+npm install
+
+```
+Then click run in Xcode, if failed, you should rebuild all package that this project used in Xcode(Just choose the package and **command+B** to run compile)
+
+If you want to run on you local iPhone app, you should follow the [doc](http://facebook.github.io/react-native/docs/runningondevice.html#content).
+
+
+
+## ScreenShots
+
+![noder](http://7lrzfj.com1.z0.glb.clouddn.com/soliurynoder.gif)
+
+
+
+## React-Native Modules Used
+
+* [react-native-button](https://github.com/ide/react-native-button)
+* [react-native-camera](https://github.com/lwansbrough/react-native-camera)
+* [react-native-icons](https://github.com/corymsmith/react-native-icons)
+* [react-native-keyboardevents](https://github.com/johanneslumpe/react-native-keyboardevents)
+* [react-native-modal](https://github.com/brentvatne/react-native-modal)
+* [react-native-overlay](https://github.com/brentvatne/react-native-overlay)
+* [react-native-scrollable-tab-view](https://github.com/brentvatne/react-native-scrollable-tab-view)
+
+Thanks All above.
+
+## ToDo List
+
+* Add up reply
+* Add setting panel
+* Add login out functional
+* Add Push Notification
+* Add about panel
+* Move the HTML render to a single Module
+* Refactor code
+* Solve the big bug
+ * ***In ListView, sometime scroll on the bottom it can't refresh***
+ * ListView **take too much memory**
+ * HTML to native View render take too much **memory and time**
+* Push to App Store
+* Add test
+
+## Change log
+
+See [CHANGELOG]()
+
+## Contribute
+
+If you find any bugs, just solve it and submit a PR.
+
+About the code style, Please use the ES6 JSX.
+
+## License
+
+[MIT License](http://en.wikipedia.org/wiki/MIT_License)
+
+
+
+
+
+
+
+
+
@@ -0,0 +1,214 @@
+var React = require('react-native');
+var window = require('../../util/window');
+var { width, height } = window.get();
+var precomputeStyle = require('precomputeStyle');
+
+
+var moment = require('moment');
+var Icon = require('FAKIconImage');
+var KeyboardEvents = require('react-native-keyboardevents');
+var KeyboardEventEmitter = KeyboardEvents.Emitter;
+var markdown = require("markdown").markdown;
+
+var HtmlContent = require('../htmlRender/htmlContent');
+var Return = require('../overlay/return');
+var CommentOverlay = require('../overlay/commentOverlay');
+var CommentHtml = require('../htmlRender/commentHtml');
+var Storage = require('../../util/storage');
+
+var topicService = require('../../services/topicService');
+
+var genColor = require('../../util/genColor');
+var config = require('../../config');
+var animations = require('../../util/animation');
+var sceneConfig = require('../../config/sceneConfig')
+var routes = require('../../config/routes')
+
+
+var {
+ View,
+ StyleSheet,
+ ScrollView,
+ Component,
+ Text,
+ StatusBarIOS,
+ Image,
+ ListView,
+ ActivityIndicatorIOS,
+ TouchableOpacity,
+ TouchableHighlight,
+ Navigator,
+ PushNotificationIOS,
+ TextInput,
+ LayoutAnimation
+ } = React
+
+
+class CommentListView extends Component {
+ constructor(props) {
+ super(props)
+ var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
+ var data = [];
+ this.state = {
+ ds: ds.cloneWithRows(data),
+ commentLoading: false,
+ user: null,
+ textInput: null,
+ replyUploading: false,
+ isLoaded: false,
+ didFocus: false
+ }
+ this.updateKeyboardSpace = this.updateKeyboardSpace.bind(this)
+ this.resetKeyboardSpace = this.resetKeyboardSpace.bind(this)
+ }
+
+ _renderRow(comment, sectionID, rowID, highlightRow) {
+ var authorName = comment.author.loginname
+ var domain = config.domain
+ var date = moment(comment.create_at).startOf('minute').fromNow();
+ var commentNum = this.comments.length - parseInt(rowID)
+ var focusStyle = {}
+ if (this.props.reply) {
+ let replyId = this.props.reply.id
+ //console.log(replyId == comment.id);
+ if (replyId == comment.id) {
+ focusStyle = {
+ backgroundColor: 'rgba(0,2,125,0.07)'
+ }
+ }
+ }
+
+ var footer = (
+ <View style={styles.commentFooter}>
+ <View style={styles.up}>
+ <TouchableOpacity
+ onPress={this._onUpPress.bind(this,comment.id)}>
+ <Icon
+ name={'ion|thumbsup'}
+ size={20}
+ color='rgba(0,0,0,0.2)'
+ style={styles.upIcon}
+ />
+ </TouchableOpacity>
+ </View>
+
+ <View style={styles.reply}>
+ <TouchableOpacity
+ onPress={this._onReplyPress.bind(this, comment.id, authorName)}>
+ <Icon
+ name={'ion|reply'}
+ size={20}
+ color='rgba(0,0,0,0.35)'
+ style={styles.replyIcon}
+ />
+ </TouchableOpacity>
+ </View>
+ </View>
+ )
+
+
+ return (
+ <View
+ ref={view=>this[comment.id]=view}
+ key={comment.id}
+ style={[styles.commentWrapper,focusStyle]}>
+ <View style={[styles.imageWrapper]}>
+ <TouchableOpacity onPress={this._onAuthorImgPress.bind(this,authorName)}>
+ <Image
+ style={styles.authorImg}
+ source={{uri:domain + comment.author.avatar_url}}
+ >
+ </Image>
+ </TouchableOpacity>
+
+ <Text style={styles.commentNumText}>
+ {commentNum} 楼
+ </Text>
+ </View>
+
+ <View style={styles.commentContentWrapper}>
+ <View style={styles.commentHeader}>
+ <View style={styles.author}>
+ <TouchableOpacity onPress={this._onAuthorTextPress.bind(this,authorName)}>
+ <Text style={styles.authorText}>
+ {{authorName}}
+ </Text>
+ </TouchableOpacity>
+ </View>
+
+ <View style={styles.date}>
+ <Text style={styles.dateText}>
+ {date}
+ </Text>
+ </View>
+ </View>
+
+ <View style={styles.commentContent}>
+ <CommentHtml
+ style={commentHtmlStyle}
+ content={comment.content}/>
+ </View>
+
+ {!this.props.user || footer}
+ </View>
+ </View>
+ )
+ }
+
+
+ _fetchComment() {
+ if (this.state.commentLoading) {
+ return
+ }
+
+ this.setState({
+ commentLoading: true
+ })
+ topicService.req.getTopicById(this.props.topic.id)
+ .then(topic=> {
+ this.topic = topic
+ return topic.replies
+ })
+ .then(replies=> {
+ return replies.reverse()
+ })
+ .then(comments=> {
+ this.comments = comments
+ this.setState({
+ ds: this.state.ds.cloneWithRows(this.comments),
+ commentLoading: false,
+ isLoaded: true
+ })
+ })
+ .catch((err)=> {
+ console.warn(err)
+ this.setState({
+ commentLoading: false
+ })
+ })
+ .done()
+ }
+
+
+ render() {
+ return (
+ <View
+ ref={view=>this.commentsView=view}
+ style={[styles.comments]}>
+ <ListView
+ ref={view => this._listView = view}
+ style={{backgroundColor:'rgba(255,255,255,1)'}}
+ showsVerticalScrollIndicator={true}
+ initialListSize={10}
+ pagingEnabled={false}
+ removeClippedSubviews={true}
+ dataSource={this.state.ds}
+ renderRow={this._renderRow.bind(this)}
+ />
+ </View>
+ )
+ }
+}
+
+
+module.exports = CommentListView
No changes.
@@ -0,0 +1,25 @@
+var React = require('react-native')
+
+var {
+ Component,
+ View
+ } = React
+
+
+class CommentUp extends Component {
+ constructor(props) {
+ super(props)
+ }
+
+
+ render() {
+ return (
+ <View>
+
+ </View>
+ )
+ }
+}
+
+
+module.exports = CommentUp
Oops, something went wrong.

0 comments on commit 3acdc3c

Please sign in to comment.