Skip to content

Commit

Permalink
升级到40版本出了各种问题,以后升级版本可以参考试一下几个命令:
Browse files Browse the repository at this point in the history
·react-native upgrade
·react-native-git-upgrade
还可以参考这篇讨论:facebook/react-native#11721
===================================我是分割线=================================
Ijkplayer扔到项目中各种头文件找不到,集成待解决。
下次更新不知道什么时候了……
  • Loading branch information
姜振华 committed Jan 7, 2017
1 parent 7a3a873 commit 4e6517b
Show file tree
Hide file tree
Showing 25 changed files with 457 additions and 260 deletions.
7 changes: 3 additions & 4 deletions .flowconfig
Expand Up @@ -28,18 +28,17 @@ experimental.strict_type_args=true

munge_underscores=true

module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
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'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-5]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-5]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-6]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-6]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy

unsafe.enable_getters_and_setters=true

[version]
^0.35.0
^0.36.0
11 changes: 11 additions & 0 deletions .gitignore
Expand Up @@ -40,3 +40,14 @@ buck-out/
\.buckd/
android/app/libs
*.keystore

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
32 changes: 17 additions & 15 deletions App/Views/VideoPage.js
Expand Up @@ -104,15 +104,16 @@ export default class VideoPage extends React.Component {

render(){
return this.source ?
(
<ListView
initialListSize={1}
dataSource={this.state.dataSource}
style={styles.listView}
renderRow={this.renderItem}
enableEmptySections={true}
renderScrollComponent={props => <RecyclerViewBackedScrollView {...props} />}
refreshControl={
(
<View style={styles.container}>
<ListView
initialListSize={1}
dataSource={this.state.dataSource}
style={styles.listView}
renderRow={this.renderItem}
enableEmptySections={true}
renderScrollComponent={props => <RecyclerViewBackedScrollView {...props} />}
refreshControl={
<RefreshControl
style={styles.refreshControlBase}
refreshing={false}
Expand All @@ -123,11 +124,12 @@ export default class VideoPage extends React.Component {
colors={['#ffaa66cc', '#ff00ddff', '#ffffbb33', '#ffff4444']}
/>
}
/>
)
:
(
<View style={styles.container}>
/>
</View>
)
:
(
<View style={{flex:1,backgroundColor:'#eeeeec'}}>
<ScrollView
automaticallyAdjustContentInsets={false}
horizontal={false}
Expand All @@ -154,7 +156,7 @@ export default class VideoPage extends React.Component {
</View>
</ScrollView>
</View>
);
);
};
}

Expand Down
19 changes: 19 additions & 0 deletions App/Views/VideoRoom.js
@@ -0,0 +1,19 @@
/**
* Created by jiangzhenhua on 2017/1/7.
*/
import React from "react";
import {
requireNativeComponent
} from "react-native";

let Video = requireNativeComponent('VideoRoom',VideoRoom);

export default class VideoRoom extends React.Component {
render(){
return <Video {...this.props}/>;
}
}

VideoRoom.propTypes = {
playURL:React.PropTypes.string
}
1 change: 0 additions & 1 deletion android/app/build.gradle
Expand Up @@ -126,7 +126,6 @@ android {
}

dependencies {
compile project(':react-native-vector-icons')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
Expand Down
1 change: 0 additions & 1 deletion android/app/src/main/java/com/news/MainActivity.java
@@ -1,7 +1,6 @@
package com.news;

import com.facebook.react.ReactActivity;
import com.oblador.vectoricons.VectorIconsPackage;

public class MainActivity extends ReactActivity {

Expand Down
1 change: 0 additions & 1 deletion android/app/src/main/res/values/strings.xml
@@ -1,4 +1,3 @@
<resources>

<string name="app_name">news</string>
</resources>
2 changes: 0 additions & 2 deletions android/settings.gradle
@@ -1,5 +1,3 @@
rootProject.name = 'news'

include ':app'
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
2 changes: 1 addition & 1 deletion ios/LightHouse.h
Expand Up @@ -7,7 +7,7 @@
//

#import <UIKit/UIKit.h>
#import <RCTComponent.h>
#import <React/RCTComponent.h>

@interface LightHouse : UIView

Expand Down
2 changes: 1 addition & 1 deletion ios/LightHouseManager.h
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2017年 Facebook. All rights reserved.
//

#import "RCTViewManager.h"
#import <React/RCTViewManager.h>

@interface LightHouseManager : RCTViewManager

Expand Down
13 changes: 13 additions & 0 deletions ios/RCTConvert+UIInterfaceOrientation.h
@@ -0,0 +1,13 @@
//
// RCTConvert+UIInterfaceOrientation.h
// news
//
// Created by 姜振华 on 2017/1/7.
// Copyright © 2017年 Facebook. All rights reserved.
//

#import <React/RCTConvert.h>

@interface RCTConvert (UIInterfaceOrientation)

@end
26 changes: 26 additions & 0 deletions ios/RCTConvert+UIInterfaceOrientation.m
@@ -0,0 +1,26 @@
//
// RCTConvert+UIInterfaceOrientation.m
// news
//
// Created by 姜振华 on 2017/1/7.
// Copyright © 2017年 Facebook. All rights reserved.
//

#import "RCTConvert+UIInterfaceOrientation.h"

@implementation RCTConvert (UIInterfaceOrientation)

RCT_ENUM_CONVERTER(UIInterfaceOrientation,
(@{
@"interfaceOrientationUnknown":@(UIInterfaceOrientationPortrait),
@"interfaceOrientationPortrait":@(UIInterfaceOrientationPortrait),
@"interfaceOrientationPortraitUpsideDown":@(UIInterfaceOrientationPortraitUpsideDown),
@"interfaceOrientationLandscapeLeft":@(UIInterfaceOrientationLandscapeLeft),
@"interfaceOrientationLandscapeRight":@(UIInterfaceOrientationLandscapeRight)
}),
UIInterfaceOrientationPortrait,
integerValue)



@end
19 changes: 19 additions & 0 deletions ios/ScreenRotateManager.h
@@ -0,0 +1,19 @@
//
// ScreenRotateManager.h
// news
//
// Created by 姜振华 on 2017/1/7.
// Copyright © 2017年 Facebook. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <React/RCTBridgeModule.h>

@interface ScreenRotateManager : NSObject

+ (void)forceOrientation: (UIInterfaceOrientation)orientation;

+ (BOOL)isOrientationLandscape;

@end
55 changes: 55 additions & 0 deletions ios/ScreenRotateManager.m
@@ -0,0 +1,55 @@
//
// ScreenRotateManager.m
// news
//
// Created by 姜振华 on 2017/1/7.
// Copyright © 2017年 Facebook. All rights reserved.
//

#import "ScreenRotateManager.h"

@implementation ScreenRotateManager

RCT_EXPORT_MODULE();



RCT_EXPORT_METHOD(forceforceOrientation:(UIInterfaceOrientation)orientation)
{
[ScreenRotateManager forceOrientation:orientation];
}


+ (void)forceOrientation:(UIInterfaceOrientation)orientation {
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
SEL selector = NSSelectorFromString(@"setOrientation:");
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]];
[invocation setSelector:selector];
[invocation setTarget:[UIDevice currentDevice]];
int val = orientation;
[invocation setArgument:&val atIndex:2];
[invocation invoke];
}
}


+ (BOOL)isOrientationLandscape {
if (UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
return YES;
}else {
return NO;
}
}

- (NSDictionary *)constantsToExport
{
return @{
@"interfaceOrientationUnknown":@(UIInterfaceOrientationPortrait),
@"interfaceOrientationPortrait":@(UIInterfaceOrientationPortrait),
@"interfaceOrientationPortraitUpsideDown":@(UIInterfaceOrientationPortraitUpsideDown),
@"interfaceOrientationLandscapeLeft":@(UIInterfaceOrientationLandscapeLeft),
@"interfaceOrientationLandscapeRight":@(UIInterfaceOrientationLandscapeRight)
};
}

@end
15 changes: 15 additions & 0 deletions ios/VideoRoom.h
@@ -0,0 +1,15 @@
//
// VideoRoom.h
// news
//
// Created by 姜振华 on 2017/1/7.
// Copyright © 2017年 Facebook. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface VideoRoom : UIView

@property(nonatomic,copy)NSString* playURL;

@end
13 changes: 13 additions & 0 deletions ios/VideoRoom.m
@@ -0,0 +1,13 @@
//
// VideoRoom.m
// news
//
// Created by 姜振华 on 2017/1/7.
// Copyright © 2017年 Facebook. All rights reserved.
//

#import "VideoRoom.h"

@implementation VideoRoom

@end
13 changes: 13 additions & 0 deletions ios/VideoRoomManager.h
@@ -0,0 +1,13 @@
//
// VideoRoomManager.h
// news
//
// Created by 姜振华 on 2017/1/7.
// Copyright © 2017年 Facebook. All rights reserved.
//

#import <React/RCTViewManager.h>

@interface VideoRoomManager : RCTViewManager

@end
22 changes: 22 additions & 0 deletions ios/VideoRoomManager.m
@@ -0,0 +1,22 @@
//
// VideoRoomManager.m
// news
//
// Created by 姜振华 on 2017/1/7.
// Copyright © 2017年 Facebook. All rights reserved.
//

#import "VideoRoomManager.h"
#import "VideoRoom.h"

@implementation VideoRoomManager

RCT_EXPORT_MODULE()
RCT_EXPORT_VIEW_PROPERTY(playURL, NSString);

-(UIView*)view {
VideoRoom* videoroom = [[VideoRoom alloc]init];
return videoroom;
}

@end

0 comments on commit 4e6517b

Please sign in to comment.