Skip to content

Commit f43ee08

Browse files
committed
update all 依赖,在iOS 中模拟twitter开屏动画(Android未适配)
1 parent 3221716 commit f43ee08

File tree

16 files changed

+622
-298
lines changed

16 files changed

+622
-298
lines changed

.flowconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
5151
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
5252

5353
[version]
54-
^0.63.0
54+
^0.67.0

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@ buck-out/
5151
*/fastlane/report.xml
5252
*/fastlane/Preview.html
5353
*/fastlane/screenshots
54+
55+
# Bundle artifact
56+
*.jsbundle

ios/AwesomeProject.xcodeproj/project.pbxproj

Lines changed: 126 additions & 138 deletions
Large diffs are not rendered by default.

ios/AwesomeProject.xcodeproj/xcshareddata/xcschemes/AwesomeProject.xcscheme

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@
8080
</AdditionalOptions>
8181
</TestAction>
8282
<LaunchAction
83-
buildConfiguration = "Debug"
84-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
85-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
83+
buildConfiguration = "Release"
84+
selectedDebuggerIdentifier = ""
85+
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
8686
launchStyle = "0"
8787
useCustomWorkingDirectory = "NO"
8888
ignoresPersistentStateOnLaunch = "NO"

ios/AwesomeProject/AppDelegate.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
/**
22
* Copyright (c) 2015-present, Facebook, Inc.
3-
* All rights reserved.
43
*
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.
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
86
*/
97

108
#import <UIKit/UIKit.h>

ios/AwesomeProject/AppDelegate.m

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
/**
22
* Copyright (c) 2015-present, Facebook, Inc.
3-
* All rights reserved.
43
*
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.
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
86
*/
97

108
#import "AppDelegate.h"
@@ -19,7 +17,6 @@ @implementation AppDelegate
1917
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
2018
{
2119
NSURL *jsCodeLocation;
22-
2320

2421
#ifdef DEBUG
2522
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
@@ -38,7 +35,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3835
rootViewController.view = rootView;
3936
self.window.rootViewController = rootViewController;
4037
[self.window makeKeyAndVisible];
41-
[SplashScreen show]; // here
38+
39+
[SplashScreen show];
4240
return YES;
4341
}
4442

ios/AwesomeProject/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.0.5</string>
20+
<string>1.0.6</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>

ios/AwesomeProject/main.m

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
/**
22
* Copyright (c) 2015-present, Facebook, Inc.
3-
* All rights reserved.
43
*
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.
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
86
*/
97

108
#import <UIKit/UIKit.h>

ios/AwesomeProjectTests/AwesomeProjectTests.m

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
/**
22
* Copyright (c) 2015-present, Facebook, Inc.
3-
* All rights reserved.
43
*
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.
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
86
*/
97

108
#import <UIKit/UIKit.h>

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
{
22
"name": "AwesomeProject",
3-
"version": "0.0.1",
3+
"version": "1.0.1",
44
"private": true,
55
"scripts": {
66
"start": "node node_modules/react-native/local-cli/cli.js start",
77
"test": "jest"
88
},
99
"dependencies": {
10-
"core-js": "^2.5.3",
10+
"core-js": "^2.5.5",
1111
"immutable": "^3.8.2",
12-
"react": "16.2.0",
13-
"react-native": "^0.54.1",
12+
"react": "16.3.1",
13+
"react-native": "0.55.2",
1414
"react-native-blur": "^3.2.2",
1515
"react-native-code-push": "^5.3.2",
1616
"react-native-linear-gradient": "^2.4.0",
1717
"react-native-modalbox": "^1.4.2",
1818
"react-native-popup-dialog": "^0.11.46",
19-
"react-native-snap-carousel": "^3.6.0",
19+
"react-native-snap-carousel": "^3.7.0",
2020
"react-native-splash-screen": "^3.0.6",
21-
"react-native-vector-icons": "^4.5.0",
22-
"react-navigation": "^1.5.1",
23-
"react-navigation-redux-helpers": "^1.0.3",
21+
"react-native-vector-icons": "^4.6.0",
22+
"react-navigation": "^1.5.11",
23+
"react-navigation-redux-helpers": "^1.0.5",
2424
"react-redux": "^5.0.7",
2525
"redux": "^3.7.2",
2626
"redux-logger": "^3.0.6",
2727
"redux-thunk": "^2.2.0",
28-
"teaset": "^0.5.5"
28+
"teaset": "^0.5.6"
2929
},
3030
"devDependencies": {
3131
"babel-jest": "22.4.1",

src/image/twitter.png

4.2 KB
Loading

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React,{ Component } from 'react';
22
import { Provider } from 'react-redux';
3-
import { AppRegistry,View } from 'react-native';
3+
import { AppRegistry } from 'react-native';
44
import AppWithNavigationState from "./navigators";
55
import store,{ middleware } from './redux/util';
66
import CodePush from 'react-native-code-push'

src/modules/MaskedView.js

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
2+
import * as React from 'react';
3+
import {
4+
Animated,
5+
StatusBar,
6+
View,
7+
StyleSheet,
8+
MaskedViewIOS,
9+
} from 'react-native';
10+
11+
type Props = {
12+
children: React.Node,
13+
isLoaded: boolean,
14+
imageSource: any,
15+
backgroundStyle: any,
16+
};
17+
18+
type State = {
19+
loadingProgress: Animated.Value,
20+
animationDone: boolean,
21+
};
22+
23+
export default class Loader extends React.Component<Props, State> {
24+
static defaultProps = {
25+
isLoaded: false,
26+
};
27+
28+
state = {
29+
loadingProgress: new Animated.Value(0),
30+
animationDone: false,
31+
};
32+
33+
componentWillReceiveProps(nextProps: Props) {
34+
if (nextProps.isLoaded && !this.props.isLoaded) {
35+
Animated.timing(this.state.loadingProgress, {
36+
toValue: 100,
37+
duration: 1000,
38+
useNativeDriver: true,
39+
}).start(() => {
40+
this.setState({
41+
animationDone: true,
42+
});
43+
});
44+
}
45+
}
46+
47+
render() {
48+
const opacityClearToVisible = {
49+
opacity: this.state.loadingProgress.interpolate({
50+
inputRange: [0, 15, 30],
51+
outputRange: [0, 0, 1],
52+
extrapolate: 'clamp',
53+
}),
54+
};
55+
56+
const imageScale = {
57+
transform: [
58+
{
59+
scale: this.state.loadingProgress.interpolate({
60+
inputRange: [0, 10, 100],
61+
outputRange: [1, 0.8, 70],
62+
}),
63+
},
64+
],
65+
};
66+
67+
const appScale = {
68+
transform: [
69+
{
70+
scale: this.state.loadingProgress.interpolate({
71+
inputRange: [0, 7, 100],
72+
outputRange: [1.1, 1.03, 1],
73+
}),
74+
},
75+
],
76+
};
77+
78+
const fullScreenBackgroundLayer = this.state.animationDone ? null : (
79+
<View style={[StyleSheet.absoluteFill, this.props.backgroundStyle]} />
80+
);
81+
const fullScreenWhiteLayer = this.state.animationDone ? null : (
82+
<View style={[StyleSheet.absoluteFill, styles.fullScreenWhiteLayer]} />
83+
);
84+
85+
return (
86+
<View style={styles.fullScreen}>
87+
<StatusBar animated={true} hidden={!this.state.animationDone} />
88+
{fullScreenBackgroundLayer}
89+
<MaskedViewIOS
90+
style={{ flex: 1 }}
91+
maskElement={
92+
<View style={styles.centeredFullScreen}>
93+
<Animated.Image
94+
style={[styles.maskImageStyle, imageScale]}
95+
source={this.props.imageSource}
96+
/>
97+
</View>
98+
}
99+
>
100+
{fullScreenWhiteLayer}
101+
<Animated.View style={[opacityClearToVisible, appScale, { flex: 1 }]}>
102+
{this.props.children}
103+
</Animated.View>
104+
</MaskedViewIOS>
105+
</View>
106+
);
107+
}
108+
}
109+
110+
const styles = StyleSheet.create({
111+
fullScreen: {
112+
flex: 1,
113+
},
114+
centeredFullScreen: {
115+
flex: 1,
116+
justifyContent: 'center',
117+
alignItems: 'center',
118+
},
119+
maskImageStyle: {
120+
height: 100,
121+
width: 100,
122+
},
123+
fullScreenWhiteLayer: {
124+
backgroundColor: 'white',
125+
},
126+
});

src/navigators/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React,{ Component } from 'react';
22
import { connect } from 'react-redux';
3-
import { BackHandler,ToastAndroid,View,Text, } from "react-native";
3+
import { BackHandler,ToastAndroid,View,Text,YellowBox } from "react-native";
44
import { DialogButton,DialogTitle } from "react-native-popup-dialog";
55
import SplashScreen from 'react-native-splash-screen';
66
import * as dialogType from "../redux/actions/dialogType";
@@ -18,12 +18,14 @@ const cancelBtn = {
1818
text: '取消按钮',
1919
onPress: ()=>false
2020
};
21+
// 临时 取消警告⚠️
22+
YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated', 'Module RCTImageLoader']);
2123
class ReduxNavigation extends Component {
2224
componentDidMount() {
2325
BackHandler.addEventListener("hardwareBackPress", this.onBackButtonPressAndroid);
2426
setTimeout(()=>{
2527
SplashScreen.hide();
26-
},1500);
28+
},1000);
2729
}
2830
componentWillUnmount() {
2931
BackHandler.removeEventListener("hardwareBackPress", this.onBackButtonPressAndroid);

0 commit comments

Comments
 (0)