├── .watchmanconfig
├── .gitattributes
├── .babelrc
├── navigatorBar.js
├── android
├── settings.gradle
├── app
│ ├── src
│ │ └── main
│ │ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ └── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── react_native_weibo
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── MainApplication.java
│ │ │ └── AndroidManifest.xml
│ ├── BUCK
│ ├── proguard-rules.pro
│ └── build.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── keystores
│ ├── debug.keystore.properties
│ └── BUCK
├── build.gradle
├── gradle.properties
├── gradlew.bat
└── gradlew
├── app.json
├── image
├── new.png
├── 下箭头.png
├── 二维码.png
├── 发现.png
├── 大于号.png
├── 广告.png
├── 注册.png
├── 消息.png
├── 消息头.png
├── 点赞.png
├── 用户.png
├── 登录.png
├── 相机.png
├── 评论.png
├── 转发.png
├── find.png
├── home.png
├── item1.png
├── item2.png
├── item3.png
├── item4.png
├── item5.png
├── item6.png
├── item7.png
├── item8.png
├── item9.png
├── mine.png
├── 差号-加粗.png
├── item10.png
├── item11.png
├── item12.png
├── item13.png
├── item14.png
├── message.png
├── mine01.png
├── mine02.png
├── mine03.png
├── mine04.png
├── mine05.png
├── mine06.png
├── mine07.png
├── mine08.png
├── mine09.png
├── mine10.png
├── no-login.png
├── prrson.png
├── attention.png
├── person_bg.jpg
├── find_selected.png
├── home_selected.png
├── mine_notLogin.jpg
├── mine_selected.png
├── new_selected.png
├── no-login-bg.png
├── small_house.png
└── message_selcted.png
├── projectPic
├── 12.png
├── 9.png
├── weibo1.png
├── weibo10.png
├── weibo11.png
├── weibo13.png
├── weibo14.png
├── weibo15.png
├── weibo2.png
├── weibo3.png
├── weibo4.png
├── weibo5.png
├── weibo6.png
├── weibo7.png
└── weibo8.png
├── ios
├── react_native_weibo
│ ├── Images.xcassets
│ │ ├── Contents.json
│ │ ├── 信息.imageset
│ │ │ ├── 信息.png
│ │ │ └── Contents.json
│ │ ├── 灯泡.imageset
│ │ │ ├── 灯泡.png
│ │ │ └── Contents.json
│ │ ├── 邮箱.imageset
│ │ │ ├── 邮箱.png
│ │ │ └── Contents.json
│ │ ├── AppIcon.appiconset
│ │ │ ├── icon.png
│ │ │ ├── icon@2x.png
│ │ │ ├── icon@3x.png
│ │ │ ├── icon_os7@2x.png
│ │ │ └── Contents.json
│ │ └── LaunchImage.launchimage
│ │ │ ├── Default@2x.png
│ │ │ ├── Default-568h@2x.png
│ │ │ ├── Default-667h@2x.png
│ │ │ ├── Default-736h@3x.png
│ │ │ └── Contents.json
│ ├── AppDelegate.h
│ ├── main.m
│ ├── AppDelegate.m
│ ├── Info.plist
│ └── Base.lproj
│ │ └── LaunchScreen.xib
├── CalendarManager.h
├── CalendarManager.m
├── react_native_weiboTests
│ ├── Info.plist
│ └── react_native_weiboTests.m
├── react_native_weibo-tvOSTests
│ └── Info.plist
├── react_native_weibo-tvOS
│ └── Info.plist
└── react_native_weibo.xcodeproj
│ └── xcshareddata
│ └── xcschemes
│ ├── react_native_weibo.xcscheme
│ └── react_native_weibo-tvOS.xcscheme
├── .buckconfig
├── APP
├── Message
│ ├── message.json
│ ├── message.js
│ ├── message_notlogin.js
│ └── message_logined.js
├── Mine
│ ├── infoItem.js
│ ├── settingItem.js
│ ├── mineItem.js
│ ├── mine.js
│ ├── mine_notlogin.js
│ ├── setting.js
│ └── mine_logined.js
├── Utils
│ ├── navigator1.js
│ └── navigator2.js
├── Home
│ ├── bottomInfo.js
│ ├── home.js
│ ├── headerInfo.js
│ ├── home_notlogin.js
│ ├── login.js
│ ├── home_logined.js
│ └── modalView.js
├── New
│ ├── swiperItem.js
│ ├── newStatuses.js
│ └── new.js
└── Find
│ └── find.js
├── __tests__
├── index.ios.js
└── index.android.js
├── index.ios.js
├── index.android.js
├── package.json
├── .gitignore
├── root.js
├── .flowconfig
├── README.md
└── tabBar.js
/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.pbxproj -text
2 |
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["react-native"]
3 | }
--------------------------------------------------------------------------------
/navigatorBar.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/4/24.
3 | */
4 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'react_native_weibo'
2 |
3 | include ':app'
4 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react_native_weibo",
3 | "displayName": "react_native_weibo"
4 | }
--------------------------------------------------------------------------------
/image/new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/new.png
--------------------------------------------------------------------------------
/image/下箭头.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/下箭头.png
--------------------------------------------------------------------------------
/image/二维码.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/二维码.png
--------------------------------------------------------------------------------
/image/发现.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/发现.png
--------------------------------------------------------------------------------
/image/大于号.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/大于号.png
--------------------------------------------------------------------------------
/image/广告.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/广告.png
--------------------------------------------------------------------------------
/image/注册.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/注册.png
--------------------------------------------------------------------------------
/image/消息.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/消息.png
--------------------------------------------------------------------------------
/image/消息头.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/消息头.png
--------------------------------------------------------------------------------
/image/点赞.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/点赞.png
--------------------------------------------------------------------------------
/image/用户.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/用户.png
--------------------------------------------------------------------------------
/image/登录.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/登录.png
--------------------------------------------------------------------------------
/image/相机.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/相机.png
--------------------------------------------------------------------------------
/image/评论.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/评论.png
--------------------------------------------------------------------------------
/image/转发.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/转发.png
--------------------------------------------------------------------------------
/image/find.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/find.png
--------------------------------------------------------------------------------
/image/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/home.png
--------------------------------------------------------------------------------
/image/item1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/item1.png
--------------------------------------------------------------------------------
/image/item2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/item2.png
--------------------------------------------------------------------------------
/image/item3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/item3.png
--------------------------------------------------------------------------------
/image/item4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/item4.png
--------------------------------------------------------------------------------
/image/item5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/item5.png
--------------------------------------------------------------------------------
/image/item6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/item6.png
--------------------------------------------------------------------------------
/image/item7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/item7.png
--------------------------------------------------------------------------------
/image/item8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/item8.png
--------------------------------------------------------------------------------
/image/item9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/item9.png
--------------------------------------------------------------------------------
/image/mine.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/mine.png
--------------------------------------------------------------------------------
/image/差号-加粗.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/差号-加粗.png
--------------------------------------------------------------------------------
/image/item10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/item10.png
--------------------------------------------------------------------------------
/image/item11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/item11.png
--------------------------------------------------------------------------------
/image/item12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/item12.png
--------------------------------------------------------------------------------
/image/item13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/item13.png
--------------------------------------------------------------------------------
/image/item14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/item14.png
--------------------------------------------------------------------------------
/image/message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/message.png
--------------------------------------------------------------------------------
/image/mine01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/mine01.png
--------------------------------------------------------------------------------
/image/mine02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/mine02.png
--------------------------------------------------------------------------------
/image/mine03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/mine03.png
--------------------------------------------------------------------------------
/image/mine04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/mine04.png
--------------------------------------------------------------------------------
/image/mine05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/mine05.png
--------------------------------------------------------------------------------
/image/mine06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/mine06.png
--------------------------------------------------------------------------------
/image/mine07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/mine07.png
--------------------------------------------------------------------------------
/image/mine08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/mine08.png
--------------------------------------------------------------------------------
/image/mine09.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/mine09.png
--------------------------------------------------------------------------------
/image/mine10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/mine10.png
--------------------------------------------------------------------------------
/image/no-login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/no-login.png
--------------------------------------------------------------------------------
/image/prrson.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/prrson.png
--------------------------------------------------------------------------------
/projectPic/12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/12.png
--------------------------------------------------------------------------------
/projectPic/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/9.png
--------------------------------------------------------------------------------
/image/attention.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/attention.png
--------------------------------------------------------------------------------
/image/person_bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/person_bg.jpg
--------------------------------------------------------------------------------
/image/find_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/find_selected.png
--------------------------------------------------------------------------------
/image/home_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/home_selected.png
--------------------------------------------------------------------------------
/image/mine_notLogin.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/mine_notLogin.jpg
--------------------------------------------------------------------------------
/image/mine_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/mine_selected.png
--------------------------------------------------------------------------------
/image/new_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/new_selected.png
--------------------------------------------------------------------------------
/image/no-login-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/no-login-bg.png
--------------------------------------------------------------------------------
/image/small_house.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/small_house.png
--------------------------------------------------------------------------------
/projectPic/weibo1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/weibo1.png
--------------------------------------------------------------------------------
/projectPic/weibo10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/weibo10.png
--------------------------------------------------------------------------------
/projectPic/weibo11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/weibo11.png
--------------------------------------------------------------------------------
/projectPic/weibo13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/weibo13.png
--------------------------------------------------------------------------------
/projectPic/weibo14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/weibo14.png
--------------------------------------------------------------------------------
/projectPic/weibo15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/weibo15.png
--------------------------------------------------------------------------------
/projectPic/weibo2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/weibo2.png
--------------------------------------------------------------------------------
/projectPic/weibo3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/weibo3.png
--------------------------------------------------------------------------------
/projectPic/weibo4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/weibo4.png
--------------------------------------------------------------------------------
/projectPic/weibo5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/weibo5.png
--------------------------------------------------------------------------------
/projectPic/weibo6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/weibo6.png
--------------------------------------------------------------------------------
/projectPic/weibo7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/weibo7.png
--------------------------------------------------------------------------------
/projectPic/weibo8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/projectPic/weibo8.png
--------------------------------------------------------------------------------
/image/message_selcted.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/image/message_selcted.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | react_native_weibo
3 |
4 |
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/.buckconfig:
--------------------------------------------------------------------------------
1 |
2 | [android]
3 | target = Google Inc.:Google APIs:23
4 |
5 | [maven_repositories]
6 | central = https://repo1.maven.org/maven2
7 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/keystores/debug.keystore.properties:
--------------------------------------------------------------------------------
1 | key.store=debug.keystore
2 | key.alias=androiddebugkey
3 | key.store.password=android
4 | key.alias.password=android
5 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/信息.imageset/信息.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/ios/react_native_weibo/Images.xcassets/信息.imageset/信息.png
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/灯泡.imageset/灯泡.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/ios/react_native_weibo/Images.xcassets/灯泡.imageset/灯泡.png
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/邮箱.imageset/邮箱.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/ios/react_native_weibo/Images.xcassets/邮箱.imageset/邮箱.png
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/AppIcon.appiconset/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/ios/react_native_weibo/Images.xcassets/AppIcon.appiconset/icon.png
--------------------------------------------------------------------------------
/android/keystores/BUCK:
--------------------------------------------------------------------------------
1 | keystore(
2 | name = "debug",
3 | properties = "debug.keystore.properties",
4 | store = "debug.keystore",
5 | visibility = [
6 | "PUBLIC",
7 | ],
8 | )
9 |
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/AppIcon.appiconset/icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/ios/react_native_weibo/Images.xcassets/AppIcon.appiconset/icon@2x.png
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/AppIcon.appiconset/icon@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/ios/react_native_weibo/Images.xcassets/AppIcon.appiconset/icon@3x.png
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/AppIcon.appiconset/icon_os7@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/ios/react_native_weibo/Images.xcassets/AppIcon.appiconset/icon_os7@2x.png
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/LaunchImage.launchimage/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/ios/react_native_weibo/Images.xcassets/LaunchImage.launchimage/Default@2x.png
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/ios/react_native_weibo/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/ios/react_native_weibo/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/LaunchImage.launchimage/Default-736h@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shaoting0730/react_native_weibo/HEAD/ios/react_native_weibo/Images.xcassets/LaunchImage.launchimage/Default-736h@3x.png
--------------------------------------------------------------------------------
/APP/Message/message.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 |
4 | },
5 | {
6 | "img":"邮箱.png",
7 | "txt":"@我的"
8 | },
9 | {
10 | "img":"信息.png",
11 | "txt":"评论"
12 | },
13 | {
14 | "img":"灯泡.png",
15 | "txt":"赞"
16 | }
17 | ]
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6 |
--------------------------------------------------------------------------------
/__tests__/index.ios.js:
--------------------------------------------------------------------------------
1 | import 'react-native';
2 | import React from 'react';
3 | import Index from '../index.ios.js';
4 |
5 | // Note: test renderer must be required after react-native.
6 | import renderer from 'react-test-renderer';
7 |
8 | it('renders correctly', () => {
9 | const tree = renderer.create(
10 |
11 | );
12 | });
13 |
--------------------------------------------------------------------------------
/__tests__/index.android.js:
--------------------------------------------------------------------------------
1 | import 'react-native';
2 | import React from 'react';
3 | import Index from '../index.android.js';
4 |
5 | // Note: test renderer must be required after react-native.
6 | import renderer from 'react-test-renderer';
7 |
8 | it('renders correctly', () => {
9 | const tree = renderer.create(
10 |
11 | );
12 | });
13 |
--------------------------------------------------------------------------------
/ios/CalendarManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // CalendarManager.h
3 | // rnAndN
4 | //
5 | // Created by Shaoting Zhou on 2017/2/10.
6 | // Copyright © 2017年 Facebook. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "React/RCTBridgeModule.h"
11 | #import "React/RCTLog.h"
12 | @interface CalendarManager : NSObject
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/index.ios.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Sample React Native App
3 | * https://github.com/facebook/react-native
4 | * @flow
5 | */
6 |
7 | import React, { Component } from 'react';
8 | import {
9 | AppRegistry,
10 | StyleSheet,
11 | Text,
12 | View
13 | } from 'react-native';
14 | import Root from './root'
15 |
16 | AppRegistry.registerComponent('react_native_weibo', () => Root);
--------------------------------------------------------------------------------
/index.android.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Sample React Native App
3 | * https://github.com/facebook/react-native
4 | * @flow
5 | */
6 |
7 | import React, { Component } from 'react';
8 | import {
9 | AppRegistry,
10 | StyleSheet,
11 | Text,
12 | View
13 | } from 'react-native';
14 | import Root from './root'
15 |
16 |
17 | AppRegistry.registerComponent('react_native_weibo', () => Root);
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/信息.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "信息.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/灯泡.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "灯泡.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/邮箱.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "邮箱.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/android/app/src/main/java/com/react_native_weibo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.react_native_weibo;
2 |
3 | import com.facebook.react.ReactActivity;
4 |
5 | public class MainActivity extends ReactActivity {
6 |
7 | /**
8 | * Returns the name of the main component registered from JavaScript.
9 | * This is used to schedule rendering of the component.
10 | */
11 | @Override
12 | protected String getMainComponentName() {
13 | return "react_native_weibo";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/ios/react_native_weibo/AppDelegate.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 |
12 | @interface AppDelegate : UIResponder
13 |
14 | @property (nonatomic, strong) UIWindow *window;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/ios/react_native_weibo/main.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 |
12 | #import "AppDelegate.h"
13 |
14 | int main(int argc, char * argv[]) {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react_native_weibo",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "start": "node node_modules/react-native/local-cli/cli.js start",
7 | "test": "jest"
8 | },
9 | "dependencies": {
10 | "react": "16.0.0-alpha.6",
11 | "react-native": "0.43.4",
12 | "react-native-swiper": "^1.5.4",
13 | "react-native-tab-navigator": "^0.3.3"
14 | },
15 | "devDependencies": {
16 | "babel-jest": "19.0.0",
17 | "babel-preset-react-native": "1.9.1",
18 | "jest": "19.0.2",
19 | "react-test-renderer": "16.0.0-alpha.6"
20 | },
21 | "jest": {
22 | "preset": "react-native"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.3'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | mavenLocal()
18 | jcenter()
19 | maven {
20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
21 | url "$rootDir/../node_modules/react-native/android"
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/ios/CalendarManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // CalendarManager.m
3 | // rnAndN
4 | //
5 | // Created by Shaoting Zhou on 2017/2/10.
6 | // Copyright © 2017年 Facebook. All rights reserved.
7 | //
8 |
9 | #import "CalendarManager.h"
10 | @implementation CalendarManager
11 |
12 | RCT_EXPORT_MODULE();
13 |
14 | // 清理缓存
15 | RCT_EXPORT_METHOD(cleanCache:(RCTResponseSenderBlock)callback)
16 | {
17 | NSURLCache *httpCache = [NSURLCache sharedURLCache];
18 | [httpCache removeAllCachedResponses];
19 | NSUInteger cache = [httpCache currentDiskUsage];
20 | callback(@[[NSNull null],@(cache)]);
21 | }
22 |
23 | RCT_EXPORT_METHOD(cacheSize:(RCTResponseSenderBlock)callback)
24 | {
25 | NSURLCache *httpCache = [NSURLCache sharedURLCache];
26 | NSUInteger cache = [httpCache currentDiskUsage];
27 | callback(@[[NSNull null],@(cache)]);
28 | }
29 | @end
30 |
--------------------------------------------------------------------------------
/ios/react_native_weiboTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ios/react_native_weibo-tvOSTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | android.useDeprecatedNdk=true
21 |
--------------------------------------------------------------------------------
/APP/Mine/infoItem.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/5/2.
3 | */
4 | import React, { Component } from 'react';
5 | import {
6 | AppRegistry,
7 | StyleSheet,
8 | Text,
9 | View,
10 | Image,
11 | TouchableOpacity,
12 | Dimensions
13 | } from 'react-native';
14 | export default class InfoItem extends Component {
15 | render() {
16 | return (
17 | alert(this.props.txt1)}>
18 |
19 | {this.props.txt1}
20 | {this.props.txt2}
21 |
22 |
23 | );
24 | }
25 | }
26 |
27 | const styles = StyleSheet.create({
28 | container: {
29 | width:80,
30 | height:80,
31 | justifyContent:'center',
32 | alignItems:'center'
33 | }
34 | });
35 |
36 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | project.xcworkspace
24 |
25 | # Android/IntelliJ
26 | #
27 | build/
28 | .idea
29 | .gradle
30 | local.properties
31 | *.iml
32 |
33 | # node.js
34 | #
35 | node_modules/
36 | npm-debug.log
37 | yarn-error.log
38 |
39 | # BUCK
40 | buck-out/
41 | \.buckd/
42 | *.keystore
43 |
44 | # fastlane
45 | #
46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47 | # screenshots whenever they are needed.
48 | # For more information about the recommended setup visit:
49 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
50 |
51 | fastlane/report.xml
52 | fastlane/Preview.html
53 | fastlane/screenshots
54 |
--------------------------------------------------------------------------------
/root.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/4/24.
3 | */
4 |
5 | import React, { Component } from 'react';
6 | import {
7 | AppRegistry,
8 | StyleSheet,
9 | Text,
10 | View,
11 | Navigator
12 | } from 'react-native';
13 | import TabBar from './tabBar'
14 | export default class Root extends Component {
15 | configureScene(e) {
16 | if(e.component.name == "New" || e.component.name == 'NewStatuses'){ //如果点击的按钮是new,则是从底部推出
17 | return Navigator.SceneConfigs.FloatFromBottom;
18 | }
19 |
20 | return conf = Navigator.SceneConfigs.HorizontalSwipeJump;
21 | conf.gestures = null; //去除手滑动走push和pop
22 | return conf;
23 | }
24 | renderScene(route, navigator) {
25 | return ;
26 | }
27 | render() {
28 | return (
29 |
34 | );
35 | }
36 | }
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/APP/Mine/settingItem.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/5/8.
3 | */
4 | import React, { Component } from 'react';
5 | import {
6 | AppRegistry,
7 | StyleSheet,
8 | Text,
9 | View,
10 | Image,
11 | TouchableOpacity,
12 | Dimensions
13 | } from 'react-native';
14 | export default class SettingItem extends Component {
15 | render() {
16 | return (
17 | alert(this.props.txt1)}>
18 |
19 | {this.props.txt1}
20 | {this.props.txt2}
21 |
22 |
23 |
24 | );
25 | }
26 | }
27 |
28 | const styles = StyleSheet.create({
29 | container: {
30 | width:80,
31 | height:80,
32 | justifyContent:'center',
33 | alignItems:'center'
34 | }
35 | });
--------------------------------------------------------------------------------
/android/app/src/main/java/com/react_native_weibo/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.react_native_weibo;
2 |
3 | import android.app.Application;
4 |
5 | import com.facebook.react.ReactApplication;
6 | import com.facebook.react.ReactNativeHost;
7 | import com.facebook.react.ReactPackage;
8 | import com.facebook.react.shell.MainReactPackage;
9 | import com.facebook.soloader.SoLoader;
10 |
11 | import java.util.Arrays;
12 | import java.util.List;
13 |
14 | public class MainApplication extends Application implements ReactApplication {
15 |
16 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
17 | @Override
18 | public boolean getUseDeveloperSupport() {
19 | return BuildConfig.DEBUG;
20 | }
21 |
22 | @Override
23 | protected List getPackages() {
24 | return Arrays.asList(
25 | new MainReactPackage()
26 | );
27 | }
28 | };
29 |
30 | @Override
31 | public ReactNativeHost getReactNativeHost() {
32 | return mReactNativeHost;
33 | }
34 |
35 | @Override
36 | public void onCreate() {
37 | super.onCreate();
38 | SoLoader.init(this, /* native exopackage */ false);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "extent" : "full-screen",
5 | "idiom" : "iphone",
6 | "subtype" : "736h",
7 | "filename" : "Default-736h@3x.png",
8 | "minimum-system-version" : "8.0",
9 | "orientation" : "portrait",
10 | "scale" : "3x"
11 | },
12 | {
13 | "extent" : "full-screen",
14 | "idiom" : "iphone",
15 | "subtype" : "667h",
16 | "filename" : "Default-667h@2x.png",
17 | "minimum-system-version" : "8.0",
18 | "orientation" : "portrait",
19 | "scale" : "2x"
20 | },
21 | {
22 | "orientation" : "portrait",
23 | "idiom" : "iphone",
24 | "filename" : "Default@2x.png",
25 | "extent" : "full-screen",
26 | "minimum-system-version" : "7.0",
27 | "scale" : "2x"
28 | },
29 | {
30 | "extent" : "full-screen",
31 | "idiom" : "iphone",
32 | "subtype" : "retina4",
33 | "filename" : "Default-568h@2x.png",
34 | "minimum-system-version" : "7.0",
35 | "orientation" : "portrait",
36 | "scale" : "2x"
37 | }
38 | ],
39 | "info" : {
40 | "version" : 1,
41 | "author" : "xcode"
42 | }
43 | }
--------------------------------------------------------------------------------
/APP/Mine/mineItem.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/5/2.
3 | */
4 | import React, { Component } from 'react';
5 | import {
6 | AppRegistry,
7 | StyleSheet,
8 | Text,
9 | View,
10 | Image,
11 | TouchableOpacity,
12 | Dimensions
13 | } from 'react-native';
14 | export default class MineItem extends Component {
15 | render() {
16 | return (
17 | alert(this.props.txt1)}>
18 |
19 |
20 | {this.props.txt1}
21 | {this.props.txt2}
22 |
23 |
24 |
25 | );
26 | }
27 | }
28 |
29 | const styles = StyleSheet.create({
30 | container: {
31 | width:80,
32 | height:80,
33 | justifyContent:'center',
34 | alignItems:'center'
35 | }
36 | });
37 |
38 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
12 |
13 |
19 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/APP/Utils/navigator1.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/4/26.
3 | */
4 | import React, { Component } from 'react';
5 | import {
6 | AppRegistry,
7 | StyleSheet,
8 | Text,
9 | View,
10 | Dimensions,
11 | TouchableOpacity
12 | } from 'react-native';
13 | var {width,height} = Dimensions.get('window');
14 |
15 | export default class Navigator1 extends Component {
16 | render() {
17 | return (
18 |
19 | this.props.leftAction()}>
20 | {this.props.leftText}
21 |
22 |
23 | {this.props.centerText}
24 |
25 | this.props.rightAction()}>
26 | {this.props.rightText}
27 |
28 |
29 | );
30 | }
31 |
32 | }
33 |
34 | const styles = StyleSheet.create({
35 | container: {
36 | width: width,
37 | height: 69,
38 | flexDirection:'row',
39 | alignItems:'center',
40 | justifyContent:'space-between',
41 | borderBottomWidth:1,
42 | borderColor:'#C1CDCD'
43 | }
44 | });
45 |
46 |
--------------------------------------------------------------------------------
/ios/react_native_weibo/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "1x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "2x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "29x29",
26 | "scale" : "3x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "2x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "40x40",
36 | "scale" : "3x"
37 | },
38 | {
39 | "size" : "57x57",
40 | "idiom" : "iphone",
41 | "filename" : "icon.png",
42 | "scale" : "1x"
43 | },
44 | {
45 | "size" : "57x57",
46 | "idiom" : "iphone",
47 | "filename" : "icon@2x.png",
48 | "scale" : "2x"
49 | },
50 | {
51 | "size" : "60x60",
52 | "idiom" : "iphone",
53 | "filename" : "icon_os7@2x.png",
54 | "scale" : "2x"
55 | },
56 | {
57 | "size" : "60x60",
58 | "idiom" : "iphone",
59 | "filename" : "icon@3x.png",
60 | "scale" : "3x"
61 | }
62 | ],
63 | "info" : {
64 | "version" : 1,
65 | "author" : "xcode"
66 | }
67 | }
--------------------------------------------------------------------------------
/APP/Utils/navigator2.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/4/26.
3 | */
4 | import React, { Component } from 'react';
5 | import {
6 | AppRegistry,
7 | StyleSheet,
8 | Text,
9 | View,
10 | Dimensions,
11 | TouchableOpacity,
12 | Image
13 | } from 'react-native';
14 | var {width,height} = Dimensions.get('window');
15 |
16 | export default class Navigator2 extends Component {
17 | render() {
18 | return (
19 |
20 | this.props.leftAction()}>
21 |
22 |
23 |
24 | {this.props.centerText}
25 |
26 | this.props.rightAction()} >
27 |
28 |
29 |
30 | );
31 | }
32 |
33 | }
34 |
35 | const styles = StyleSheet.create({
36 | container: {
37 | width: width,
38 | height: 69,
39 | flexDirection:'row',
40 | alignItems:'center',
41 | justifyContent:'space-between',
42 | borderBottomWidth:1,
43 | borderColor:'#C1CDCD'
44 | }
45 | });
46 |
47 |
48 |
--------------------------------------------------------------------------------
/ios/react_native_weibo/AppDelegate.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import "AppDelegate.h"
11 |
12 | #import
13 | #import
14 |
15 | @implementation AppDelegate
16 |
17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
18 | {
19 | NSURL *jsCodeLocation;
20 |
21 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
22 |
23 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
24 | moduleName:@"react_native_weibo"
25 | initialProperties:nil
26 | launchOptions:launchOptions];
27 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
28 |
29 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
30 | UIViewController *rootViewController = [UIViewController new];
31 | rootViewController.view = rootView;
32 | self.window.rootViewController = rootViewController;
33 | [self.window makeKeyAndVisible];
34 | return YES;
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/.flowconfig:
--------------------------------------------------------------------------------
1 | [ignore]
2 | ; We fork some components by platform
3 | .*/*[.]android.js
4 |
5 | ; Ignore "BUCK" generated dirs
6 | /\.buckd/
7 |
8 | ; Ignore unexpected extra "@providesModule"
9 | .*/node_modules/.*/node_modules/fbjs/.*
10 |
11 | ; Ignore duplicate module providers
12 | ; For RN Apps installed via npm, "Libraries" folder is inside
13 | ; "node_modules/react-native" but in the source repo it is in the root
14 | .*/Libraries/react-native/React.js
15 | .*/Libraries/react-native/ReactNative.js
16 |
17 | [include]
18 |
19 | [libs]
20 | node_modules/react-native/Libraries/react-native/react-native-interface.js
21 | node_modules/react-native/flow
22 | flow/
23 |
24 | [options]
25 | emoji=true
26 |
27 | module.system=haste
28 |
29 | experimental.strict_type_args=true
30 |
31 | munge_underscores=true
32 |
33 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
34 |
35 | suppress_type=$FlowIssue
36 | suppress_type=$FlowFixMe
37 | suppress_type=$FixMe
38 |
39 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-0]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
40 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-0]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
41 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
42 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
43 |
44 | unsafe.enable_getters_and_setters=true
45 |
46 | [version]
47 | ^0.40.0
48 |
--------------------------------------------------------------------------------
/ios/react_native_weibo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | react_native_weibo
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 | NSAllowsArbitraryLoads
30 |
31 |
32 | NSLocationWhenInUseUsageDescription
33 |
34 | UIRequiredDeviceCapabilities
35 |
36 | armv7
37 |
38 | UISupportedInterfaceOrientations
39 |
40 | UIInterfaceOrientationPortrait
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | UIViewControllerBasedStatusBarAppearance
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/APP/Home/bottomInfo.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/5/8.
3 | */
4 | import React, { Component } from 'react';
5 | import {
6 | AppRegistry,
7 | StyleSheet,
8 | Text,
9 | View,
10 | Image,
11 | TouchableOpacity,
12 | Dimensions,
13 | AsyncStorage
14 | } from 'react-native';
15 |
16 | export default class BottomInfo extends Component {
17 |
18 | render() {
19 | const rowData = this.props.rowData
20 | return (
21 |
22 |
23 |
24 | {rowData.reposts_count == 0 ? '转发' :rowData.reposts_count}
25 |
26 |
27 |
28 | {rowData.comments_count == 0 ? '转发' :rowData.comments_count}
29 |
30 |
31 |
32 | {rowData.attitudes_count == 0 ? '转发' :rowData.attitudes_count}
33 |
34 |
35 | );
36 | }
37 | }
38 |
39 | const styles = StyleSheet.create({
40 | container: {
41 | width:80,
42 | height:80,
43 | justifyContent:'center',
44 | alignItems:'center'
45 | }
46 | });
47 |
--------------------------------------------------------------------------------
/APP/Mine/mine.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/4/24.
3 | */
4 |
5 | import React, { Component } from 'react';
6 | import {
7 | AppRegistry,
8 | StyleSheet,
9 | Text,
10 | View,
11 | AsyncStorage
12 | } from 'react-native';
13 | import Logined from './mine_logined'
14 | import NoLogin from './mine_notlogin'
15 |
16 |
17 | export default class Mine extends Component {
18 |
19 | // 构造
20 | constructor(props) {
21 | super(props);
22 | // 初始状态
23 | this.state = {
24 | access_token:null
25 | };
26 | }
27 |
28 | render() {
29 | if(this.state.access_token != null){
30 | return (
31 |
32 | );
33 | }else{
34 | return (
35 |
36 | );
37 | }
38 | }
39 |
40 | componentWillMount (){
41 | //取出本地化的access_token
42 | AsyncStorage.getItem(
43 | 'access_token',
44 | (error,result)=>{
45 | if (!error){
46 | this.setState({
47 | access_token:result
48 | })
49 | }
50 | }
51 | )
52 | }
53 | }
54 |
55 |
56 |
57 | const styles = StyleSheet.create({
58 | container: {
59 | flex: 1,
60 | justifyContent: 'center',
61 | alignItems: 'center',
62 | backgroundColor: '#F5FCFF',
63 | },
64 | welcome: {
65 | fontSize: 20,
66 | textAlign: 'center',
67 | margin: 10,
68 | },
69 | instructions: {
70 | textAlign: 'center',
71 | color: '#333333',
72 | marginBottom: 5,
73 | },
74 | });
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/ios/react_native_weibo-tvOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UIViewControllerBasedStatusBarAppearance
38 |
39 | NSLocationWhenInUseUsageDescription
40 |
41 | NSAppTransportSecurity
42 |
43 |
44 | NSExceptionDomains
45 |
46 | localhost
47 |
48 | NSExceptionAllowsInsecureHTTPLoads
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/android/app/BUCK:
--------------------------------------------------------------------------------
1 | # To learn about Buck see [Docs](https://buckbuild.com/).
2 | # To run your application with Buck:
3 | # - install Buck
4 | # - `npm start` - to start the packager
5 | # - `cd android`
6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8 | # - `buck install -r android/app` - compile, install and run application
9 | #
10 |
11 | lib_deps = []
12 |
13 | for jarfile in glob(['libs/*.jar']):
14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15 | lib_deps.append(':' + name)
16 | prebuilt_jar(
17 | name = name,
18 | binary_jar = jarfile,
19 | )
20 |
21 | for aarfile in glob(['libs/*.aar']):
22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23 | lib_deps.append(':' + name)
24 | android_prebuilt_aar(
25 | name = name,
26 | aar = aarfile,
27 | )
28 |
29 | android_library(
30 | name = "all-libs",
31 | exported_deps = lib_deps,
32 | )
33 |
34 | android_library(
35 | name = "app-code",
36 | srcs = glob([
37 | "src/main/java/**/*.java",
38 | ]),
39 | deps = [
40 | ":all-libs",
41 | ":build_config",
42 | ":res",
43 | ],
44 | )
45 |
46 | android_build_config(
47 | name = "build_config",
48 | package = "com.react_native_weibo",
49 | )
50 |
51 | android_resource(
52 | name = "res",
53 | package = "com.react_native_weibo",
54 | res = "src/main/res",
55 | )
56 |
57 | android_binary(
58 | name = "app",
59 | keystore = "//android/keystores:debug",
60 | manifest = "src/main/AndroidManifest.xml",
61 | package_type = "debug",
62 | deps = [
63 | ":app-code",
64 | ],
65 | )
66 |
--------------------------------------------------------------------------------
/APP/Home/home.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/4/24.
3 | */
4 | //首页:这里取出本地化的access_token.判断
5 | import React, { Component } from 'react';
6 | import {
7 | AppRegistry,
8 | StyleSheet,
9 | Text,
10 | View,
11 | AsyncStorage,
12 | Image,
13 | DeviceEventEmitter
14 | } from 'react-native';
15 |
16 | import NoLogin from './home_notlogin'
17 | import Logined from './home_logined'
18 |
19 | export default class Home extends Component {
20 | // 构造
21 | constructor(props) {
22 | super(props);
23 | // 初始状态
24 | this.state = {
25 | access_token:null
26 | };
27 | }
28 | render() {
29 |
30 | if(this.state.access_token != null){
31 | return (
32 |
33 | );
34 | }else{
35 | return (
36 |
37 | );
38 | }
39 |
40 | }
41 |
42 | componentWillMount (){
43 | AsyncStorage.getItem(
44 | 'access_token',
45 | (error,result)=>{
46 | if (!error){
47 | this.setState({
48 | access_token:result
49 | })
50 | }
51 | }
52 | )
53 |
54 | }
55 |
56 |
57 |
58 | }
59 |
60 | const styles = StyleSheet.create({
61 | container: {
62 | flex: 1,
63 | justifyContent: 'center',
64 | alignItems: 'center',
65 | backgroundColor: '#F5FCFF',
66 | },
67 | welcome: {
68 | fontSize: 20,
69 | textAlign: 'center',
70 | margin: 10,
71 | },
72 | instructions: {
73 | textAlign: 'center',
74 | color: '#333333',
75 | marginBottom: 5,
76 | },
77 | });
78 |
79 |
80 |
--------------------------------------------------------------------------------
/APP/Message/message.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/4/24.
3 | */
4 |
5 | import React, { Component } from 'react';
6 | import {
7 | AppRegistry,
8 | StyleSheet,
9 | Text,
10 | View,
11 | AsyncStorage
12 | } from 'react-native';
13 | import Logined from './message_logined'
14 | import NoLogin from './message_notlogin'
15 |
16 | export default class Message extends Component {
17 |
18 | // 构造
19 | constructor(props) {
20 | super(props);
21 | // 初始状态
22 | this.state = {
23 | access_token:null
24 | };
25 | }
26 | render() {
27 |
28 | if(this.state.access_token != null){
29 | return (
30 |
31 | );
32 | }else{
33 | return (
34 |
35 | );
36 | }
37 |
38 | }
39 |
40 | componentWillMount (){
41 | //取出本地化的access_token
42 | AsyncStorage.getItem(
43 | 'access_token',
44 | (error,result)=>{
45 | if (!error){
46 | this.setState({
47 | access_token:result
48 | })
49 | }
50 | }
51 | )
52 | }
53 |
54 |
55 |
56 |
57 | }
58 |
59 | const styles = StyleSheet.create({
60 | container: {
61 | flex: 1,
62 | justifyContent: 'center',
63 | alignItems: 'center',
64 | backgroundColor: '#F5FCFF',
65 | },
66 | welcome: {
67 | fontSize: 20,
68 | textAlign: 'center',
69 | margin: 10,
70 | },
71 | instructions: {
72 | textAlign: 'center',
73 | color: '#333333',
74 | marginBottom: 5,
75 | },
76 | });
77 |
78 |
79 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 基于React Native 制作的微博客户端
2 | ## 因为微博授权权限设置,本人的微博开放者账号权限太低,如果出现 'api请求次数受限,请更换. 10023' 弹框 或者 授权界面出错,需要自行更换开放者应用的appkey,授权回调页,App Secret. 修改位置在 App/Home/login.js
3 | [ 新浪微博开放者平台 ]( http://open.weibo.com/ )
4 | 因为项目较为简单,所以不使用redux或者mbox.其实,因为我不太会.这么说吧,这个demo适合初学者
5 | 使用的第三方库:
6 | "react-native-swiper": "^1.5.4"
7 | "react-native-tab-navigator": "^0.3.3"
8 | 完成功能:
9 | - [x] 除少量控件外以基本适配iOS和Android
10 | - [x] 授权登录
11 | - [x] 授权注销
12 | - [x] 微博首页原创微博
13 | - [x] 微博首页转发微博
14 | - [x] 我的界面个人信息
15 | - [x] 中间按钮基本界面搭建
16 | - [x] 发送纯文字微博
17 | - [x] 我的设置界面搭建
18 | - [x] iOS端清除缓存功能
19 | - [x] 删除微博功能
20 | - [ ] 其他
21 | 运行截图:
22 | 
23 | 
24 | 
25 | 
26 | 
27 | 
28 | 
29 | 
30 | 
31 | 
32 | 
33 | 
34 | 
35 | 
36 |
37 |
--------------------------------------------------------------------------------
/APP/New/swiperItem.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/4/24.
3 | */
4 |
5 | import React, { Component } from 'react';
6 | import {
7 | AppRegistry,
8 | StyleSheet,
9 | Text,
10 | View,
11 | Image,
12 | TouchableOpacity,
13 | Dimensions,
14 | AsyncStorage
15 | } from 'react-native';
16 | import NewStatuses from './newStatuses'
17 | import Login from '../Home/login'
18 |
19 | export default class SwiperItem extends Component {
20 | render() {
21 | return (
22 | this.itemOnclick()}>
23 |
24 |
25 | {this.props.text}
26 |
27 |
28 | );
29 | }
30 | itemOnclick = ()=>{
31 | AsyncStorage.getItem(
32 | 'access_token',
33 | (error,result)=>{
34 | if (!error) {
35 | if (result != null) {
36 |
37 | if (this.props.text == '文字') {
38 | this.props.mynavigator.push(
39 | {
40 | component: NewStatuses,
41 | passProps: {
42 | 'access_token': result
43 | }
44 | }
45 | )
46 | }
47 | }else {
48 | this.props.mynavigator.push(
49 | {
50 | component: Login,
51 | }
52 | )
53 | }
54 | }
55 | }
56 | )
57 |
58 |
59 |
60 |
61 | }
62 | }
63 |
64 | const styles = StyleSheet.create({
65 | container: {
66 | width:80,
67 | height:80,
68 | justifyContent:'center',
69 | alignItems:'center'
70 | }
71 | });
72 |
73 |
--------------------------------------------------------------------------------
/ios/react_native_weiboTests/react_native_weiboTests.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 | #import
12 |
13 | #import
14 | #import
15 |
16 | #define TIMEOUT_SECONDS 600
17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
18 |
19 | @interface react_native_weiboTests : XCTestCase
20 |
21 | @end
22 |
23 | @implementation react_native_weiboTests
24 |
25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
26 | {
27 | if (test(view)) {
28 | return YES;
29 | }
30 | for (UIView *subview in [view subviews]) {
31 | if ([self findSubviewInView:subview matching:test]) {
32 | return YES;
33 | }
34 | }
35 | return NO;
36 | }
37 |
38 | - (void)testRendersWelcomeScreen
39 | {
40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
42 | BOOL foundElement = NO;
43 |
44 | __block NSString *redboxError = nil;
45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
46 | if (level >= RCTLogLevelError) {
47 | redboxError = message;
48 | }
49 | });
50 |
51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
54 |
55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
57 | return YES;
58 | }
59 | return NO;
60 | }];
61 | }
62 |
63 | RCTSetLogFunction(RCTDefaultLogFunction);
64 |
65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
67 | }
68 |
69 |
70 | @end
71 |
--------------------------------------------------------------------------------
/APP/Home/headerInfo.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/5/8.
3 | */
4 | import React, { Component } from 'react';
5 | import {
6 | AppRegistry,
7 | StyleSheet,
8 | Text,
9 | View,
10 | Image,
11 | TouchableOpacity,
12 | Dimensions,
13 | AsyncStorage,
14 | Modal
15 | } from 'react-native';
16 | import ModalView from './modalView'
17 |
18 | export default class HeaderInfo extends Component {
19 | // 构造
20 | constructor(props) {
21 | super(props);
22 | // 初始状态
23 | this.state = {
24 | show:false
25 | };
26 | }
27 | render() {
28 | const rowData = this.props.rowData
29 | // 截取字符串 微博 weibo.com
30 | let textEnd = ''
31 | if(rowData.source){
32 | let ary = rowData.source.split('<')
33 | let text = ary[1]
34 | let startIndex = text.indexOf('>')
35 | textEnd = text.substring(startIndex + 1,text.length)
36 | textEnd = '来自 ' + textEnd
37 | }
38 | return (
39 |
40 |
41 |
42 | {rowData.user.name}
43 | {textEnd}
44 |
45 | this.modalShow()} style={{position:'absolute',right:5}}>
46 |
47 |
48 | {/*modal*/}
49 |
54 | this.modalShow()} mynavigator = {this.props.mynavigator} />
55 |
56 |
57 | );
58 | }
59 |
60 | modalShow = () =>{
61 | this.setState({
62 | show:!this.state.show
63 | })
64 | }
65 | }
66 |
67 | const styles = StyleSheet.create({
68 | container: {
69 | width:80,
70 | height:80,
71 | justifyContent:'center',
72 | alignItems:'center'
73 | }
74 | });
75 |
--------------------------------------------------------------------------------
/APP/New/newStatuses.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/5/5.
3 | */
4 | import React, { Component } from 'react';
5 | import {
6 | AppRegistry,
7 | StyleSheet,
8 | Text,
9 | View,
10 | Image,
11 | TouchableOpacity,
12 | Dimensions,
13 | TextInput,
14 | AsyncStorage
15 | } from 'react-native';
16 | import Navigator1 from '../Utils/navigator1'
17 | import TabBar from '../../tabBar'
18 |
19 | var {width,height} = Dimensions.get('window');
20 |
21 | export default class NewStatuses extends Component {
22 | render() {
23 | return (
24 |
25 | this.leftAction()} rightAction = {() => this.rightAction()}/>
26 |
34 |
35 | );
36 | }
37 |
38 | componentWillMount(){
39 |
40 | }
41 |
42 | leftAction =()=>{
43 | //返回首页
44 | this.props.navigator.immediatelyResetRouteStack([
45 | {
46 | component:TabBar
47 | }
48 | ])
49 | }
50 |
51 | rightAction =()=>{
52 | let text = this.refs.myTextInput._lastNativeText
53 | if(text.length > 0){
54 | let uri = 'https://api.weibo.com/2/statuses/update.json'
55 | let params = 'access_token=' + this.props.access_token + '&status=' + text
56 | fetch(uri,{
57 | method:'POST',
58 | headers: {
59 | 'Content-Type': 'application/x-www-form-urlencoded'
60 | },
61 | body: params,
62 | })
63 | .then((response) => response.json())
64 | .then((json) => {
65 | //返回首页
66 | this.props.navigator.immediatelyResetRouteStack([
67 | {
68 | component:TabBar
69 | }
70 | ])
71 |
72 | })
73 | }else {
74 | alert('请发送1-140个字符')
75 | }
76 |
77 | }
78 | }
79 |
80 | const styles = StyleSheet.create({
81 | container: {
82 | width:80,
83 | height:80,
84 | justifyContent:'center',
85 | alignItems:'center'
86 | }
87 | });
88 |
89 |
--------------------------------------------------------------------------------
/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Disabling obfuscation is useful if you collect stack traces from production crashes
20 | # (unless you are using a system that supports de-obfuscate the stack traces).
21 | -dontobfuscate
22 |
23 | # React Native
24 |
25 | # Keep our interfaces so they can be used by other ProGuard rules.
26 | # See http://sourceforge.net/p/proguard/bugs/466/
27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
30 |
31 | # Do not strip any method/class that is annotated with @DoNotStrip
32 | -keep @com.facebook.proguard.annotations.DoNotStrip class *
33 | -keep @com.facebook.common.internal.DoNotStrip class *
34 | -keepclassmembers class * {
35 | @com.facebook.proguard.annotations.DoNotStrip *;
36 | @com.facebook.common.internal.DoNotStrip *;
37 | }
38 |
39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
40 | void set*(***);
41 | *** get*();
42 | }
43 |
44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; }
46 | -keepclassmembers,includedescriptorclasses class * { native ; }
47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; }
48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; }
49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; }
50 |
51 | -dontwarn com.facebook.react.**
52 |
53 | # okhttp
54 |
55 | -keepattributes Signature
56 | -keepattributes *Annotation*
57 | -keep class okhttp3.** { *; }
58 | -keep interface okhttp3.** { *; }
59 | -dontwarn okhttp3.**
60 |
61 | # okio
62 |
63 | -keep class sun.misc.Unsafe { *; }
64 | -dontwarn java.nio.file.*
65 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
66 | -dontwarn okio.**
67 |
--------------------------------------------------------------------------------
/APP/Message/message_notlogin.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import {
3 | AppRegistry,
4 | StyleSheet,
5 | Text,
6 | View,
7 | AsyncStorage,
8 | Image,
9 | Dimensions,
10 | TouchableOpacity,
11 | Navigator
12 | } from 'react-native';
13 |
14 | var {width,height} = Dimensions.get('window');
15 | import Navigator1 from '../Utils/navigator1'
16 | import Login from '../Home/login'
17 |
18 | export default class Message_notlogin extends Component {
19 |
20 | // 构造
21 | constructor(props) {
22 | super(props);
23 | // 初始状态
24 | this.state = {
25 | access_token:null
26 | };
27 | }
28 | render() {
29 | return (
30 |
31 | this.leftAction()} rightAction = {() => this.rightAction()}/>
32 |
33 |
34 | 登录后,别人评论你的微博,给你发消息,都会在这里收到通知
35 |
36 | this.registerAction()}>
37 |
38 |
39 | this.loginAction()}>
40 |
41 |
42 |
43 |
44 |
45 |
46 | );
47 | }
48 |
49 |
50 |
51 | registerAction = () =>{
52 | alert('微博api未公开注册接口,点击登录跳转注册')
53 | }
54 |
55 | loginAction = () =>{
56 | this.props.mynavigator.push(
57 | {
58 | component:Login,
59 | }
60 | )
61 | }
62 |
63 |
64 |
65 |
66 | leftAction =() =>{
67 |
68 | }
69 | rightAction = () =>{
70 |
71 | }
72 |
73 |
74 | }
75 |
76 | const styles = StyleSheet.create({
77 | container: {
78 | flex: 1,
79 | justifyContent: 'center',
80 | alignItems: 'center',
81 | backgroundColor: '#F5FCFF',
82 | },
83 | welcome: {
84 | fontSize: 20,
85 | textAlign: 'center',
86 | margin: 10,
87 | },
88 | instructions: {
89 | textAlign: 'center',
90 | color: '#333333',
91 | marginBottom: 5,
92 | },
93 | });
94 |
95 |
--------------------------------------------------------------------------------
/APP/Find/find.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/4/24.
3 | */
4 |
5 | import React, { Component } from 'react';
6 | import {
7 | AppRegistry,
8 | StyleSheet,
9 | Text,
10 | View,
11 | AsyncStorage
12 | } from 'react-native';
13 | import TabBar from '../../tabBar'
14 | export default class Find extends Component {
15 | render() {
16 | return (
17 |
18 | this.loginOut()}>
19 | 注销
20 |
21 |
22 | );
23 | }
24 |
25 |
26 | loginOut =()=> {
27 | // 取值里面 有 网络请求 有 移除本地存值 有 跳转 ? 性能问题
28 | AsyncStorage.getItem(
29 | 'access_token',
30 | (error, result) => {
31 | if (!error) {
32 | //值有 开始网络请求
33 | fetch('https://api.weibo.com/oauth2/revokeoauth2?access_token=' + result)
34 | .then((response) => response.json())
35 | .then((json) => {
36 | console.log(json)
37 | if(json.result == "true"){ //只有服务器移除授权之后才移除本地存值
38 | AsyncStorage.removeItem(
39 | 'access_token',
40 | (error)=>{
41 | if(!error){
42 | //移除完之后开始跳界面
43 | this.props.navigator.immediatelyResetRouteStack([
44 | {
45 | component:TabBar
46 | }
47 | ])
48 | }
49 | }
50 | )
51 | }else {
52 | alert('没登录,点个毛')
53 | }
54 |
55 | })
56 | }
57 | }
58 | )
59 |
60 |
61 | }
62 |
63 | }
64 |
65 | const styles = StyleSheet.create({
66 | container: {
67 | flex: 1,
68 | justifyContent: 'center',
69 | alignItems: 'center',
70 | backgroundColor: '#F5FCFF',
71 | },
72 | welcome: {
73 | fontSize: 20,
74 | textAlign: 'center',
75 | margin: 10,
76 | },
77 | instructions: {
78 | textAlign: 'center',
79 | color: '#333333',
80 | marginBottom: 5,
81 | },
82 | });
83 |
84 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/APP/Home/home_notlogin.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/4/26.
3 | */
4 | // 没有access_token
5 | import React, { Component } from 'react';
6 | import {
7 | AppRegistry,
8 | StyleSheet,
9 | Text,
10 | View,
11 | Dimensions,
12 | Animated,
13 | Easing,
14 | Image
15 | } from 'react-native';
16 |
17 | import Navigator1 from '../Utils/navigator1'
18 |
19 | var {width,height} = Dimensions.get('window');
20 | import Login from './login'
21 |
22 | export default class Home_notlogin extends Component {
23 | // 构造
24 | constructor(props) {
25 | super(props);
26 | this.spinValue = new Animated.Value(0)
27 | // 初始状态
28 | this.state = {
29 | };
30 | }
31 |
32 | render() {
33 | const spin = this.spinValue.interpolate({
34 | inputRange: [0, 1],
35 | outputRange: ['0deg', '360deg']
36 | })
37 |
38 | return (
39 |
40 | this.leftAction()} rightAction = {() => this.rightAction()}/>
41 |
42 |
43 |
44 |
45 | 关注一些人,回到这里看看有什么惊囍
46 |
47 |
48 |
49 |
50 | );
51 | }
52 |
53 | leftAction =() =>{
54 | alert('微博api未公开注册接口,点击登录跳转注册')
55 | }
56 | //登录按钮
57 | rightAction = () =>{
58 | this.props.mynavigator.push(
59 | {
60 | component:Login,
61 | }
62 | )
63 | }
64 |
65 |
66 | //旋转动画
67 | spin () {
68 | this.spinValue.setValue(0)
69 | Animated.timing(
70 | this.spinValue,
71 | {
72 | toValue: 1,
73 | duration: 10000,
74 | easing: Easing.linear
75 | }
76 | ).start(()=>this.spin())
77 | }
78 |
79 | componentWillMount (){
80 | this.spin()
81 | }
82 | }
83 |
84 | const styles = StyleSheet.create({
85 | container: {
86 | flex: 1,
87 | justifyContent: 'center',
88 | alignItems: 'center',
89 | backgroundColor: '#F5FCFF',
90 | },
91 | welcome: {
92 | fontSize: 20,
93 | textAlign: 'center',
94 | margin: 10,
95 | },
96 | instructions: {
97 | textAlign: 'center',
98 | color: '#333333',
99 | marginBottom: 5,
100 | },
101 | });
102 |
103 |
--------------------------------------------------------------------------------
/APP/Message/message_logined.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import {
3 | AppRegistry,
4 | StyleSheet,
5 | Text,
6 | View,
7 | AsyncStorage,
8 | TextInput,
9 | ListView,
10 | Image,
11 | Dimensions
12 | } from 'react-native';
13 | import Navigator2 from '../Utils/navigator2'
14 | import MessageAry from './message.json'
15 |
16 | var {width,height} = Dimensions.get('window');
17 | var ds = new ListView.DataSource({rowHasChanged:(r1,r2) => r1 !== r2});
18 |
19 | export default class Message_logined extends Component {
20 |
21 | // 构造
22 | constructor(props) {
23 | super(props);
24 | // 初始状态
25 | this.state = {
26 | access_token:null,
27 | dataSource:ds.cloneWithRows(MessageAry),
28 | };
29 | }
30 | render() {
31 | return (
32 |
33 | this.leftAction()} rightAction = {() => this.rightAction()}/>
34 |
39 |
40 | );
41 | }
42 | leftAction =() =>{
43 |
44 | }
45 |
46 | rightAction = () =>{
47 | alert('二维码')
48 |
49 | }
50 |
51 | renderRow =(rowData,sectionID,rowID,highlightRow) =>{
52 | if(rowID == 0){ //第一行
53 | return (
54 |
55 |
56 |
57 | )
58 | }else if(rowID > 0 && rowID < 4){ // 2-4
59 | return (
60 |
61 |
62 |
63 |
64 | {rowData.txt}
65 |
66 |
67 |
68 |
69 |
70 | )
71 | }else { //其他
72 | return (
73 |
74 | 333
75 |
76 | )
77 | }
78 |
79 |
80 | }
81 |
82 |
83 | }
84 |
85 | const styles = StyleSheet.create({
86 | container: {
87 | flex: 1,
88 | justifyContent: 'center',
89 | alignItems: 'center',
90 | backgroundColor: '#F5FCFF',
91 | },
92 | welcome: {
93 | fontSize: 20,
94 | textAlign: 'center',
95 | margin: 10,
96 | },
97 | instructions: {
98 | textAlign: 'center',
99 | color: '#333333',
100 | marginBottom: 5,
101 | },
102 | });
103 |
104 |
--------------------------------------------------------------------------------
/APP/Mine/mine_notlogin.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/5/2.
3 | */
4 | import React, { Component } from 'react';
5 | import {
6 | AppRegistry,
7 | StyleSheet,
8 | Text,
9 | View,
10 | AsyncStorage,
11 | Image,
12 | Dimensions,
13 | TouchableOpacity,
14 | Navigator,
15 | } from 'react-native';
16 |
17 | var {width,height} = Dimensions.get('window');
18 | import Navigator1 from '../Utils/navigator1'
19 | import Login from '../Home/login'
20 |
21 | export default class Mine_notlogin extends Component {
22 |
23 | // 构造
24 | constructor(props) {
25 | super(props);
26 | // 初始状态
27 | this.state = {
28 | access_token:null
29 | };
30 | }
31 | render() {
32 | return (
33 |
34 | this.leftAction()} rightAction = {() => this.rightAction()}/>
35 |
36 |
37 |
38 |
39 |
40 |
41 | 关注
42 | 快看看大家都在关注谁
43 |
44 |
45 |
46 |
47 |
48 |
49 | 登录后.你的微薄.相册.个人资料
50 | 会显示在这里,展示给别人
51 |
52 |
53 |
54 | this.registerAction()}>
55 |
56 |
57 | this.loginAction()}>
58 |
59 |
60 |
61 |
62 |
63 | );
64 | }
65 |
66 |
67 |
68 | registerAction = () =>{
69 | alert('微博api未公开注册接口,点击登录跳转注册')
70 | }
71 |
72 | loginAction = () =>{
73 | this.props.mynavigator.push(
74 | {
75 | component:Login,
76 | }
77 | )
78 | }
79 |
80 |
81 |
82 |
83 | leftAction =() =>{
84 |
85 | }
86 | rightAction = () =>{
87 |
88 | }
89 |
90 |
91 | }
92 |
93 | const styles = StyleSheet.create({
94 | container: {
95 | flex: 1,
96 | justifyContent: 'center',
97 | alignItems: 'center',
98 | backgroundColor: '#F5FCFF',
99 | },
100 | welcome: {
101 | fontSize: 20,
102 | textAlign: 'center',
103 | margin: 10,
104 | },
105 | instructions: {
106 | textAlign: 'center',
107 | color: '#333333',
108 | marginBottom: 5,
109 | },
110 | });
111 |
112 |
--------------------------------------------------------------------------------
/ios/react_native_weibo/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
25 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/APP/Home/login.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/4/26.
3 | */
4 | //授权界面
5 | // https://api.weibo.com/oauth2/authorize?client_id=428058221&redirect_uri=http://www.baidu.com
6 | import React, { Component } from 'react';
7 | import {
8 | AppRegistry,
9 | StyleSheet,
10 | Text,
11 | View,
12 | WebView,
13 | Dimensions,
14 | AsyncStorage,
15 | ActivityIndicator
16 | } from 'react-native';
17 |
18 | import Navigator1 from '../Utils/navigator1'
19 | import TabBar from '../../tabBar'
20 |
21 |
22 | var {width,height} = Dimensions.get('window');
23 | var client_id = "308768878" // appkey
24 | var redirect_uri = "http://www.baidu.com" //授权回调页
25 | var client_secret = "43a1d0a73c0a4940ea5691b73cf3a577" //App Secret
26 | export default class Login extends Component {
27 |
28 | render() {
29 | let uri = 'https://api.weibo.com/oauth2/authorize?client_id=' + client_id + '&redirect_uri=' + redirect_uri
30 | return (
31 |
32 | this.leftAction()} rightAction = {() => this.rightAction()}/>
33 |
34 | this.onNavigationStateChange(e)}
37 | style={{width:width,height:height,backgroundColor:'gray'}}
38 | source={{uri:uri,method: 'GET'}}
39 | startInLoadingState = {true}
40 | renderLoading = {this.renderActivityIndicator}
41 | />
42 |
43 | );
44 |
45 | }
46 | renderActivityIndicator (){
47 | return(
48 |
49 |
50 |
51 | )
52 | }
53 |
54 | //获取code
55 | onNavigationStateChange =(e) =>{
56 | if(e.loading == true){
57 | var indexStart = e.url.indexOf('=')
58 | var indexEnd = e.url.indexOf('&')
59 | var code = e.url.substring(indexStart+1,indexEnd)
60 | this.loginAction(code) // 获取授权
61 | }
62 | }
63 |
64 | //获取授权
65 | loginAction =(code) =>{
66 | // 网络请求里面 有 存值 有 跳转 ? 性能问题
67 | var uri = 'https://api.weibo.com/oauth2/access_token' + '?client_id=' + client_id + '&client_secret=' + client_secret + '&grant_type=' + 'authorization_code' + '&code=' + code + '&redirect_uri=' + redirect_uri
68 | fetch(uri,{
69 | method:'POST',
70 | })
71 | .then((response) => response.json())
72 | .then((json) => {
73 |
74 | if(json.access_token){
75 | //请求uid
76 | let url = 'https://api.weibo.com/2/account/get_uid.json?access_token=' + json.access_token
77 | fetch(url)
78 | .then((response) => response.json())
79 | .then((json) => {
80 | let uid = json.uid.toString()
81 | //存uid
82 | AsyncStorage.setItem(
83 | 'uid',
84 | uid,
85 | );
86 |
87 | })
88 |
89 |
90 | //存access_token
91 | AsyncStorage.setItem(
92 | 'access_token',
93 | json.access_token,
94 | (error)=>{
95 | if (!error){
96 | //返回首页
97 | this.props.navigator.immediatelyResetRouteStack([
98 | {
99 | component:TabBar
100 | }
101 | ])
102 |
103 | }
104 | }
105 | );
106 | }
107 | })
108 | }
109 |
110 | leftAction =() =>{
111 | this.props.navigator.pop({})
112 | }
113 |
114 | rightAction = () =>{
115 |
116 | }
117 |
118 |
119 |
120 |
121 | }
122 |
123 | const styles = StyleSheet.create({
124 | container: {
125 | flex: 1,
126 | },
127 | welcome: {
128 | fontSize: 20,
129 | textAlign: 'center',
130 | margin: 10,
131 | },
132 | instructions: {
133 | textAlign: 'center',
134 | color: '#333333',
135 | marginBottom: 5,
136 | },
137 | });
138 |
139 |
140 |
--------------------------------------------------------------------------------
/tabBar.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/4/24.
3 | */
4 | import React, { Component } from 'react';
5 | import {
6 | AppRegistry,
7 | StyleSheet,
8 | Text,
9 | View,
10 | Image,
11 | TouchableOpacity,
12 | Dimensions,
13 | Platform
14 | } from 'react-native';
15 |
16 | import TabNavigator from 'react-native-tab-navigator'
17 |
18 | import Home from './APP/Home/home'
19 | import Message from './APP/Message/message'
20 | import New from './APP/New/new'
21 | import Find from './APP/Find/find'
22 | import Mine from './APP/Mine/mine'
23 |
24 | var {width,height} = Dimensions.get('window');
25 |
26 |
27 |
28 | export default class TabBar extends Component {
29 | // 构造
30 | constructor(props) {
31 | super(props);
32 | // 初始状态
33 | this.state = {
34 | selectedTab: 'Home' // 默认是第一个
35 | };
36 | }
37 |
38 | render() {
39 | return (
40 |
41 |
42 | } // 图标
47 | renderSelectedIcon={() => } // 选中的图标
48 | titleStyle={styles.textStyle}
49 | onPress={() => this.setState({ selectedTab: 'Home' })}>
50 |
51 |
52 | } // 图标
57 | renderSelectedIcon={() => } // 选中的图标
58 | titleStyle={styles.textStyle}
59 | onPress={() => this.setState({ selectedTab: 'Message' })}>
60 |
61 |
62 | { this.setState({ selectedTab: 'New' })}
68 | >
69 |
70 | }
71 | } // 图标
76 | renderSelectedIcon={() => } // 选中的图标
77 | titleStyle={styles.textStyle}
78 | onPress={() => this.setState({ selectedTab: 'Find' })}>
79 |
80 |
81 | } // 图标
86 | renderSelectedIcon={() => } // 选中的图标
87 | titleStyle={styles.textStyle}
88 | onPress={() => this.setState({ selectedTab: 'Mine' })}>
89 |
90 |
91 |
92 |
93 | this.goRoute()} >
94 |
98 |
99 |
100 |
101 | );
102 | }
103 | goRoute =() =>{
104 | this.props.navigator.push({
105 | component:New
106 | })
107 | }
108 | }
109 |
110 | const styles = StyleSheet.create({
111 | container: {
112 | height: Platform.OS === 'ios' ? height : height-20 ,
113 | },
114 | iconStyle: {
115 | width: 25,
116 | height: 25,
117 | },
118 | newStyle: {
119 | position: 'absolute',
120 | marginLeft: width / 2 - 25,
121 | width: 50,
122 | height: 40,
123 | bottom:2,
124 | borderRadius: 5
125 | },
126 | selectedTitleStyle: {
127 | color: 'red'
128 | },
129 | });
130 |
--------------------------------------------------------------------------------
/ios/react_native_weibo.xcodeproj/xcshareddata/xcschemes/react_native_weibo.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
61 |
67 |
68 |
69 |
70 |
71 |
77 |
78 |
79 |
80 |
81 |
82 |
92 |
94 |
100 |
101 |
102 |
103 |
104 |
105 |
111 |
113 |
119 |
120 |
121 |
122 |
124 |
125 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/ios/react_native_weibo.xcodeproj/xcshareddata/xcschemes/react_native_weibo-tvOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
61 |
67 |
68 |
69 |
70 |
71 |
77 |
78 |
79 |
80 |
81 |
82 |
92 |
94 |
100 |
101 |
102 |
103 |
104 |
105 |
111 |
113 |
119 |
120 |
121 |
122 |
124 |
125 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/APP/Mine/setting.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/5/8.
3 | */
4 | import React, { Component } from 'react';
5 | import {
6 | AppRegistry,
7 | StyleSheet,
8 | Text,
9 | View,
10 | Image,
11 | TouchableOpacity,
12 | Dimensions,
13 | ScrollView,
14 | Platform,
15 | NativeModules,
16 | AsyncStorage
17 | } from 'react-native';
18 | import Navigator1 from '../Utils/navigator1'
19 | import SettingItem from './settingItem'
20 | import TabBar from '../../tabBar'
21 |
22 | var CalendarManager = NativeModules.CalendarManager; //导入iOS端原生
23 |
24 | export default class Setting extends Component {
25 | constructor(props) {
26 | super(props);
27 |
28 | this.state = ({
29 | cache:0 //缓存大小
30 |
31 | })
32 | }
33 | render() {
34 | return (
35 |
36 | this.leftAction()} rightAction = {() => this.rightAction()}/>
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | this.clearCache()}>
52 |
53 | 清理缓存
54 | {this.state.cache} KB
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | this.loginOut()}>
66 |
67 | 退出当前账号
68 |
69 |
70 |
71 |
72 |
73 | );
74 | }
75 |
76 | leftAction =() =>{
77 | this.props.navigator.pop({})
78 | }
79 |
80 | rightAction =() =>{
81 |
82 | }
83 |
84 | componentWillMount() {
85 | //通过原生计算缓存大小
86 | Platform.OS === 'ios' ?
87 | CalendarManager.cacheSize((error, events) => {
88 | if (error) {
89 | console.error(error);
90 | } else {
91 | this.setState({
92 | cache:Math.round((events/1024/1024)*100)
93 | })
94 | }
95 | })
96 | :
97 | console.log('安卓清除缓存未实现')
98 | }
99 |
100 | //清除缓存
101 | clearCache =() =>{
102 | Platform.OS === 'ios' ?
103 | CalendarManager.cleanCache((error, events) => {
104 | if (error) {
105 | console.error(error);
106 | } else {
107 | this.setState({
108 | cache:0
109 | })
110 | }
111 | })
112 | :
113 | console.log('安卓清除缓存未实现')
114 | }
115 |
116 | //退出登录
117 | loginOut = () =>{
118 | //值有 开始网络请求
119 | fetch('https://api.weibo.com/oauth2/revokeoauth2?access_token=' + this.props.access_token)
120 | .then((response) => response.json())
121 | .then((json) => {
122 | console.log(json)
123 | if(json.result == "true"){ //只有服务器移除授权之后才移除本地存值
124 | AsyncStorage.removeItem(
125 | 'access_token',
126 | (error)=>{
127 | if(!error){
128 | //移除完之后开始跳界面
129 | this.props.navigator.immediatelyResetRouteStack([
130 | {
131 | component:TabBar
132 | }
133 | ])
134 | }
135 | }
136 | )
137 | }
138 |
139 | })
140 | }
141 |
142 |
143 | }
144 |
145 | const styles = StyleSheet.create({
146 | container: {
147 | width:80,
148 | height:80,
149 | justifyContent:'center',
150 | alignItems:'center'
151 | }
152 | });
153 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 |
3 | import com.android.build.OutputFile
4 |
5 | /**
6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7 | * and bundleReleaseJsAndAssets).
8 | * These basically call `react-native bundle` with the correct arguments during the Android build
9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10 | * bundle directly from the development server. Below you can see all the possible configurations
11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the
12 | * `apply from: "../../node_modules/react-native/react.gradle"` line.
13 | *
14 | * project.ext.react = [
15 | * // the name of the generated asset file containing your JS bundle
16 | * bundleAssetName: "index.android.bundle",
17 | *
18 | * // the entry file for bundle generation
19 | * entryFile: "index.android.js",
20 | *
21 | * // whether to bundle JS and assets in debug mode
22 | * bundleInDebug: false,
23 | *
24 | * // whether to bundle JS and assets in release mode
25 | * bundleInRelease: true,
26 | *
27 | * // whether to bundle JS and assets in another build variant (if configured).
28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29 | * // The configuration property can be in the following formats
30 | * // 'bundleIn${productFlavor}${buildType}'
31 | * // 'bundleIn${buildType}'
32 | * // bundleInFreeDebug: true,
33 | * // bundleInPaidRelease: true,
34 | * // bundleInBeta: true,
35 | *
36 | * // the root of your project, i.e. where "package.json" lives
37 | * root: "../../",
38 | *
39 | * // where to put the JS bundle asset in debug mode
40 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
41 | *
42 | * // where to put the JS bundle asset in release mode
43 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
44 | *
45 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
46 | * // require('./image.png')), in debug mode
47 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
48 | *
49 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
50 | * // require('./image.png')), in release mode
51 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
52 | *
53 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
54 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
55 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle
56 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
57 | * // for example, you might want to remove it from here.
58 | * inputExcludes: ["android/**", "ios/**"],
59 | *
60 | * // override which node gets called and with what additional arguments
61 | * nodeExecutableAndArgs: ["node"]
62 | *
63 | * // supply additional arguments to the packager
64 | * extraPackagerArgs: []
65 | * ]
66 | */
67 |
68 | apply from: "../../node_modules/react-native/react.gradle"
69 |
70 | /**
71 | * Set this to true to create two separate APKs instead of one:
72 | * - An APK that only works on ARM devices
73 | * - An APK that only works on x86 devices
74 | * The advantage is the size of the APK is reduced by about 4MB.
75 | * Upload all the APKs to the Play Store and people will download
76 | * the correct one based on the CPU architecture of their device.
77 | */
78 | def enableSeparateBuildPerCPUArchitecture = false
79 |
80 | /**
81 | * Run Proguard to shrink the Java bytecode in release builds.
82 | */
83 | def enableProguardInReleaseBuilds = false
84 |
85 | android {
86 | compileSdkVersion 23
87 | buildToolsVersion "23.0.1"
88 |
89 | defaultConfig {
90 | applicationId "com.react_native_weibo"
91 | minSdkVersion 16
92 | targetSdkVersion 22
93 | versionCode 1
94 | versionName "1.0"
95 | ndk {
96 | abiFilters "armeabi-v7a", "x86"
97 | }
98 | }
99 | splits {
100 | abi {
101 | reset()
102 | enable enableSeparateBuildPerCPUArchitecture
103 | universalApk false // If true, also generate a universal APK
104 | include "armeabi-v7a", "x86"
105 | }
106 | }
107 | buildTypes {
108 | release {
109 | minifyEnabled enableProguardInReleaseBuilds
110 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
111 | }
112 | }
113 | // applicationVariants are e.g. debug, release
114 | applicationVariants.all { variant ->
115 | variant.outputs.each { output ->
116 | // For each separate APK per architecture, set a unique version code as described here:
117 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
118 | def versionCodes = ["armeabi-v7a":1, "x86":2]
119 | def abi = output.getFilter(OutputFile.ABI)
120 | if (abi != null) { // null for the universal-debug, universal-release variants
121 | output.versionCodeOverride =
122 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
123 | }
124 | }
125 | }
126 | }
127 |
128 | dependencies {
129 | compile fileTree(dir: "libs", include: ["*.jar"])
130 | compile "com.android.support:appcompat-v7:23.0.1"
131 | compile "com.facebook.react:react-native:+" // From node_modules
132 | }
133 |
134 | // Run this once to be able to run the application with BUCK
135 | // puts all compile dependencies into folder libs for BUCK to use
136 | task copyDownloadableDepsToLibs(type: Copy) {
137 | from configurations.compile
138 | into 'libs'
139 | }
140 |
--------------------------------------------------------------------------------
/APP/Mine/mine_logined.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/5/2.
3 | */
4 |
5 | import React, { Component } from 'react';
6 | import {
7 | AppRegistry,
8 | StyleSheet,
9 | Text,
10 | View,
11 | AsyncStorage,
12 | Image,
13 | Dimensions,
14 | TouchableOpacity,
15 | Navigator,
16 | ScrollView
17 | } from 'react-native';
18 |
19 | var {width,height} = Dimensions.get('window');
20 | import Navigator1 from '../Utils/navigator1'
21 | import MineItem from './mineItem'
22 | import Info from './infoItem'
23 | import Setting from './setting'
24 | export default class Mine_logined extends Component {
25 |
26 | // 构造
27 | constructor(props) {
28 | super(props);
29 | // 初始状态
30 | this.state = {
31 | access_token:null,
32 | statuses_count:0, //微博数
33 | friends_count:0, //关注数
34 | followers_count:0, //粉丝
35 | name:'', //用户名
36 | avatar_large:'https://s3.amazonaws.com/media-p.slid.es/uploads/alexanderfarennikov/images/1198519/reactjs.png', //头像
37 | description:'' //个人描述
38 | };
39 | }
40 | render() {
41 | return (
42 |
43 | this.leftAction()} rightAction = {() => this.rightAction()}/>
44 |
45 | {/*个人信息*/}
46 |
47 |
48 |
49 |
50 | {this.state.name}
51 | {this.state.description}
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | {/*新的好友*/}
63 |
64 |
65 | {/*我的相册,我的赞*/}
66 |
67 |
68 |
69 |
70 | {/*微博钱包 微博运动 免流量*/}
71 |
72 |
73 |
74 |
75 |
76 |
77 | {/*粉丝服务 粉丝头条*/}
78 |
79 |
80 |
81 |
82 | {/*草稿箱*/}
83 |
84 |
85 | {/*更多*/}
86 |
87 |
88 |
89 |
90 | );
91 | }
92 |
93 |
94 |
95 | leftAction = () =>{
96 | alert('添加好友')
97 | }
98 |
99 | rightAction = () =>{
100 | this.props.mynavigator.push({
101 | component:Setting,
102 | passProps:{
103 | access_token:this.props.access_token
104 | }
105 | })
106 | }
107 |
108 |
109 | componentDidMount() {
110 | //获取用户的uid
111 | //取出本地化的access_token
112 | AsyncStorage.getItem(
113 | 'uid',
114 | (error,result)=>{
115 | if (!error){
116 |
117 | let url = 'https://api.weibo.com/2/users/show.json?access_token=' + this.props.access_token + '&uid=' + result
118 | fetch(url)
119 | .then((response) => response.json())
120 | .then((json) => {
121 | if(!json.error){
122 | this.setState({
123 | avatar_large:json.avatar_large,
124 | statuses_count:json.statuses_count,
125 | friends_count:json.friends_count,
126 | followers_count:json.followers_count,
127 | name:json.name,
128 | avatar_large:json.avatar_large,
129 | description:json.description == ''? '简介: 暂无介绍' : json.description
130 | })
131 | }
132 | })
133 |
134 |
135 | }
136 | }
137 | )
138 |
139 | }
140 |
141 |
142 | }
143 |
144 | const styles = StyleSheet.create({
145 | container: {
146 | flex: 1,
147 | justifyContent: 'center',
148 | alignItems: 'center',
149 | backgroundColor: '#F5FCFF',
150 | },
151 | welcome: {
152 | fontSize: 20,
153 | textAlign: 'center',
154 | margin: 10,
155 | },
156 | instructions: {
157 | textAlign: 'center',
158 | color: '#333333',
159 | marginBottom: 5,
160 | },
161 | });
162 |
163 |
--------------------------------------------------------------------------------
/APP/Home/home_logined.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/4/26.
3 | */
4 | // 存在access_token
5 | // https://api.weibo.com/2/statuses/home_timeline.json?access_token=2.00j6v5hC0rUFy971093d5fecnXtMTB&page=2 默认20条
6 | import React, { Component } from 'react';
7 | import {
8 | AppRegistry,
9 | StyleSheet,
10 | Text,
11 | View,
12 | Dimensions,
13 | Image,
14 | ListView,
15 | AsyncStorage,
16 | TextInput,
17 | ScrollView,
18 | RefreshControl
19 | } from 'react-native';
20 |
21 | import Navigator2 from '../Utils/navigator2'
22 | import BottomInfo from './bottomInfo'
23 | import HeaderInfo from './headerInfo'
24 | var {width,height} = Dimensions.get('window');
25 |
26 | var ary = []
27 | var ds = new ListView.DataSource({rowHasChanged:(r1,r2) => r1 !== r2});
28 | var num = 1 //第几页数据
29 | export default class Home_logined extends Component {
30 |
31 | // 构造
32 | constructor(props) {
33 | super(props);
34 |
35 | // 初始状态
36 | this.state = {
37 | dataSource:ds.cloneWithRows(ary),
38 | isRefreshing:true
39 | };
40 | }
41 | render () {
42 | return (
43 |
44 | this.leftAction()} rightAction = {() => this.rightAction()}/>
45 |
46 |
47 |
48 | this.onRefreshData()}
53 | />
54 | }
55 | onEndReached={()=>this.loadMore()}
56 | dataSource={this.state.dataSource}
57 | renderRow={this.renderRow}
58 | enableEmptySections={true} //去除警告
59 | />
60 |
61 | );
62 | }
63 |
64 | onRefreshData =() =>{
65 | ary = []
66 | this.setState({
67 | dataSource: ds.cloneWithRows(ary),
68 | })
69 | this.loadData(1)
70 | }
71 | loadMore =() =>{
72 | num ++
73 | this.loadData(num)
74 | }
75 |
76 | renderRow =(rowData,sectionID,rowID,highlightRow) =>{
77 | return(
78 |
79 | {/*头像等信息*/}
80 |
81 | {/*中间微博信息*/}
82 |
83 | {rowData.text}
84 | {this.middleViewRender(rowData,sectionID,rowID,highlightRow)}
85 |
86 | {/*转发.评论.点赞*/}
87 |
88 | {/*分隔条*/}
89 |
90 |
91 |
92 | );
93 | }
94 |
95 |
96 |
97 |
98 | // 辨识是否微博转发
99 | middleViewRender (rowData,sectionID,rowID,highlightRow){
100 |
101 | if(rowData.retweeted_status){
102 | let retweeted_status = rowData.retweeted_status
103 | //转发
104 | //取出图片url
105 | var imgAry = retweeted_status.pic_urls
106 | var imgUrlAry = []
107 | imgAry.forEach(function (val, index) {
108 | var url = val.thumbnail_pic
109 | imgUrlAry.push(url)
110 | })
111 | if(imgUrlAry.length > 0) {
112 | return(
113 |
114 | @{retweeted_status.user.name}:{retweeted_status.text}
115 |
116 | {this.renderImg(imgUrlAry,rowData)}
117 |
118 |
119 |
120 | )
121 | }
122 | }else{
123 | //原创
124 | //取出图片url
125 | var imgAry = rowData.pic_urls
126 | var imgUrlAry = []
127 | imgAry.forEach(function (val, index) {
128 | var url = val.thumbnail_pic
129 | imgUrlAry.push(url)
130 | })
131 | if(imgUrlAry.length > 0) {
132 | return(
133 |
134 | {this.renderImg(imgUrlAry,rowData)}
135 |
136 | )
137 | }
138 | }
139 | }
140 |
141 | //图片render
142 | renderImg = (imgUrlAry,rowData) =>{
143 | var itemAry = [];
144 | for(var i = 0;i < imgUrlAry.length; i++){
145 | if(imgUrlAry.length == 1){ //只有一张图片,拿原图
146 | itemAry.push(
147 |
148 | )
149 | }else if(imgUrlAry.length == 2 || imgUrlAry.length == 4){
150 | itemAry.push(
151 |
152 | )
153 | }else {
154 | itemAry.push(
155 |
156 | )
157 | }
158 | }
159 |
160 | return itemAry
161 | }
162 |
163 |
164 |
165 |
166 | leftAction =() =>{
167 |
168 | }
169 |
170 | rightAction = () =>{
171 | alert('二维码')
172 |
173 | }
174 |
175 | componentDidMount (){
176 | this.loadData(1)
177 | }
178 |
179 |
180 | loadData = (num) =>{
181 | //请求数据
182 | console.log('https://api.weibo.com/2/statuses/home_timeline.json?access_token=' + this.props.access_token + '&page=' + num)
183 | let uri = 'https://api.weibo.com/2/statuses/home_timeline.json?access_token=' + this.props.access_token + '&page=' + num
184 | fetch(uri)
185 | .then((response) => response.json())
186 | .then((json) => {
187 | if (json.error_code == 10023) {
188 | alert('api请求次数受限,请更换. 10023')
189 | } else {
190 | json.statuses.forEach(function (val, index) {
191 | ary.push(val)
192 | })
193 | this.setState({
194 | dataSource: ds.cloneWithRows(ary),
195 | isRefreshing:false
196 | })
197 | }
198 | })
199 | }
200 |
201 | componentWillMount(){
202 | ary = []
203 | }
204 |
205 |
206 | }
207 |
208 | const styles = StyleSheet.create({
209 | container: {
210 | flex: 1,
211 | justifyContent: 'center',
212 | alignItems: 'center',
213 | backgroundColor: '#F5FCFF',
214 | },
215 | welcome: {
216 | fontSize: 20,
217 | textAlign: 'center',
218 | margin: 10,
219 | },
220 | instructions: {
221 | textAlign: 'center',
222 | color: '#333333',
223 | marginBottom: 5,
224 | },
225 | });
226 |
227 |
--------------------------------------------------------------------------------
/APP/New/new.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/4/24.
3 | */
4 |
5 | import React, { Component } from 'react';
6 | import {
7 | AppRegistry,
8 | StyleSheet,
9 | Text,
10 | View,
11 | Image,
12 | Dimensions,
13 | TouchableOpacity,
14 | Animated,
15 | Easing
16 | } from 'react-native';
17 | import Swiper from 'react-native-swiper'
18 | import TabBar from '../../tabBar'
19 | import SwiperItem from './swiperItem'
20 |
21 |
22 | var {width,height} = Dimensions.get('window');
23 |
24 | export default class New extends Component {
25 | // 构造
26 | constructor(props) {
27 | super(props);
28 | this.animatedValue = new Animated.Value(0)
29 | // 初始状态
30 | this.state = {
31 | date:'', //日
32 | month:'', //月
33 | fullYear:'', //年
34 | day:'', //星期
35 | weather:'' //天气
36 | };
37 | }
38 | animate () {
39 | this.animatedValue.setValue(0)
40 | Animated.timing(
41 | this.animatedValue,
42 | {
43 | toValue: 1,
44 | duration: 1000,
45 | easing: Easing.linear
46 | }
47 | ).start()
48 | }
49 | render() {
50 | const marginTop = this.animatedValue.interpolate({
51 | inputRange: [0, 1],
52 | outputRange: [300, 0]
53 | })
54 | return (
55 |
56 | {/*上方的日期天气栏目*/}
57 |
58 |
59 |
60 | {this.state.date}
61 |
62 | 周{this.state.day}
63 | {this.state.month}/{this.state.fullYear}
64 |
65 |
66 | 上海: {this.state.weather} >
67 |
68 |
69 |
70 | {/*中部的轮播*/}
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | {/*下方的X号按钮返回*/}
103 | this.backHomeAction()} style={styles.bottomStyle}>
104 |
105 |
106 |
107 |
108 |
109 | );
110 | }
111 | //X号响应事件 返回首页
112 | backHomeAction = ()=>{
113 | this.props.navigator.immediatelyResetRouteStack([
114 | {
115 | component:TabBar
116 |
117 | }
118 | ])
119 | }
120 |
121 | //获取日期 天气
122 | componentDidMount(){
123 | this.animate()
124 | var myDate = new Date();
125 | /*
126 | * myDate.getDate() 日
127 | * myDate.getMonth() 月 0-11
128 | * myDate.getFullYear() 年
129 | * myDate.getDay() 星期几
130 | * http://www.weather.com.cn/data/cityinfo/101020100.html 上海天气
131 | * */
132 | var day:'';
133 | switch(myDate.getDay())
134 | {
135 | case 1:
136 | day = '一'
137 | break;
138 | case 2:
139 | day = '二'
140 | break;
141 | case 3:
142 | day = '三'
143 | break;
144 | case 4:
145 | day = '四'
146 | break;
147 | case 5:
148 | day = '五'
149 | break;
150 | case 6:
151 | day = '六'
152 | break;
153 | default:
154 | day = '日'
155 | }
156 |
157 | this.setState({
158 | date:myDate.getDate(),
159 | month:myDate.getMonth() + 1,
160 | fullYear:myDate.getFullYear(),
161 | day:day,
162 | })
163 | //获取天气况状
164 | fetch('http://www.weather.com.cn/data/cityinfo/101020100.html')
165 | .then((response) => response.json())
166 | .then((json) => {
167 | this.setState({
168 | weather:json.weatherinfo.weather
169 | })
170 | })
171 | }
172 |
173 | }
174 |
175 | const styles = StyleSheet.create({
176 | container: {
177 | flex: 1,
178 | },
179 | slideView: {
180 | height:300,
181 | alignItems:'center'
182 | },
183 | bottomStyle: {
184 | width:width,
185 | position: 'absolute',
186 | bottom:2,
187 | height:40,
188 | justifyContent:'center',
189 | alignItems:'center'
190 | }
191 | });
192 |
193 |
194 |
195 |
--------------------------------------------------------------------------------
/APP/Home/modalView.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by shaotingzhou on 2017/5/8.
3 | */
4 |
5 | import React, { Component } from 'react';
6 | import {
7 | AppRegistry,
8 | StyleSheet,
9 | Text,
10 | View,
11 | Image,
12 | TouchableOpacity,
13 | Dimensions,
14 | AsyncStorage,
15 | ScrollView
16 | } from 'react-native';
17 | var {width,height} = Dimensions.get('window');
18 | import TabBar from '../../tabBar'
19 |
20 | export default class ModalView extends Component {
21 | // 构造
22 | constructor(props) {
23 | super(props);
24 | // 初始状态
25 | this.state = {
26 | uid:0
27 | };
28 | }
29 |
30 |
31 | render() {
32 | if(this.props.rowData.user.id == this.state.uid){
33 | return (
34 |
35 | {/*阴影*/}
36 | this.passMethod()}>
37 |
38 |
39 |
40 | {/*modal*/}
41 |
42 |
43 |
44 | 收藏
45 |
46 |
47 |
48 | 置顶
49 |
50 |
51 |
52 | 推广
53 |
54 |
55 | this.deleteStatus()}>
56 |
57 | 删除
58 |
59 |
60 |
61 | this.passMethod()}>
62 |
63 | 取消
64 |
65 |
66 |
67 |
68 |
69 |
70 | );
71 | }else {
72 | return (
73 |
74 | {/*阴影*/}
75 | this.passMethod()}>
76 |
77 |
78 |
79 | {/*modal*/}
80 |
81 |
82 |
83 | 收藏
84 |
85 |
86 |
87 | 用此卡片背景
88 |
89 |
90 |
91 | 帮上头条
92 |
93 |
94 |
95 | 取消关注
96 |
97 |
98 |
99 | 屏蔽
100 |
101 |
102 |
103 | 举报
104 |
105 |
106 | this.passMethod()}>
107 |
108 | 取消
109 |
110 |
111 |
112 |
113 |
114 |
115 | );
116 | }
117 | }
118 |
119 | passMethod = () =>{
120 | this.props.showOnclick()
121 | }
122 |
123 | componentDidMount() {
124 | //获取用户的uid
125 | //取出本地化的access_token
126 | AsyncStorage.getItem(
127 | 'uid',
128 | (error,result)=>{
129 | if (!error){
130 | this.setState({
131 | uid:result
132 | })
133 |
134 | }
135 | }
136 | )
137 |
138 | }
139 |
140 | deleteStatus = () =>{
141 | let id = this.props.rowData.id //微博id
142 | let access_token = this.props.access_token
143 | let uri = 'https://api.weibo.com/2/statuses/destroy.json'
144 | let params = 'access_token=' + access_token + '&id=' + id
145 | fetch(uri,{
146 | method:'POST',
147 | headers: {
148 | 'Content-Type': 'application/x-www-form-urlencoded'
149 | },
150 | body: params,
151 | })
152 | .then((response) => response.json())
153 | .then((json) => {
154 | //返回首页
155 | this.props.mynavigator.immediatelyResetRouteStack([
156 | {
157 | component:TabBar
158 | }
159 | ])
160 |
161 | })
162 | }
163 |
164 | }
165 |
166 | const styles = StyleSheet.create({
167 | container: {
168 | flex:1,
169 | },
170 | shadowView:{
171 | backgroundColor:'black',
172 | opacity:0.5,
173 | height: height*0.55,
174 | width: width,
175 | },
176 | //modal
177 | modalStyle:{
178 | backgroundColor:'white',
179 | width: width,
180 | height: height*0.45
181 | },
182 | });
183 |
184 |
--------------------------------------------------------------------------------