Authored by 于良

导航栏优化 review by 阿瑟

require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
Pod::Spec.new do |s|
s.name = "React"
s.version = "0.32.0"
s.summary = package['description']
s.description = <<-DESC
React Native apps are built using the React JS
framework, and render directly to native UIKit
elements using a fully asynchronous architecture.
There is no browser and no HTML. We have picked what
we think is the best set of features from these and
other technologies to build what we hope to become
the best product development framework available,
with an emphasis on iteration speed, developer
delight, continuity of technology, and absolutely
beautiful and fast products with no compromises in
quality or capability.
DESC
s.homepage = "http://facebook.github.io/react-native/"
s.license = package['license']
s.author = "Facebook"
s.source = { :git => "https://github.com/facebook/react-native.git", :tag => "v#{s.version}" }
s.default_subspec = 'Core'
s.requires_arc = true
s.platform = :ios, "7.0"
s.preserve_paths = "cli.js", "Libraries/**/*.js", "lint", "linter.js", "node_modules", "package.json", "packager", "PATENTS", "react-native-cli"
s.subspec 'Core' do |ss|
ss.dependency 'React/CSSLayout'
ss.source_files = "React/**/*.{c,h,m,mm,S}"
ss.exclude_files = "**/__tests__/*", "IntegrationTests/*", "React/CSSLayout/*", "React/Views/RCTScrollView.h", "React/Views/RCTScrollView.m", "React/Views/RCTScrollViewManager.h", "React/Views/RCTScrollViewManager.m"
ss.frameworks = "JavaScriptCore"
ss.libraries = "stdc++"
ss.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++14" }
end
s.subspec 'ART' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/ART/**/*.{h,m}"
ss.preserve_paths = "Libraries/ART/**/*.js"
end
s.subspec 'CSSLayout' do |ss|
ss.source_files = "React/CSSLayout/**/*.{c,h}"
ss.header_mappings_dir = "React"
end
s.subspec 'RCTActionSheet' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/ActionSheetIOS/*.{h,m}"
ss.preserve_paths = "Libraries/ActionSheetIOS/*.js"
end
s.subspec 'RCTAdSupport' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/AdSupport/*.{h,m}"
ss.preserve_paths = "Libraries/AdSupport/*.js"
end
s.subspec 'RCTAnimation' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/NativeAnimation/{Nodes/*,*}.{h,m}"
end
s.subspec 'RCTCameraRoll' do |ss|
ss.dependency 'React/Core'
ss.dependency 'React/RCTImage'
ss.source_files = "Libraries/CameraRoll/*.{h,m}"
ss.preserve_paths = "Libraries/CameraRoll/*.js"
end
s.subspec 'RCTGeolocation' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/Geolocation/*.{h,m}"
ss.preserve_paths = "Libraries/Geolocation/*.js"
end
s.subspec 'RCTImage' do |ss|
ss.dependency 'React/Core'
ss.dependency 'React/RCTNetwork'
ss.source_files = "Libraries/Image/*.{h,m}"
ss.preserve_paths = "Libraries/Image/*.js"
end
s.subspec 'RCTNetwork' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/Network/*.{h,m}"
ss.preserve_paths = "Libraries/Network/*.js"
end
s.subspec 'RCTPushNotification' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/PushNotificationIOS/*.{h,m}"
ss.preserve_paths = "Libraries/PushNotificationIOS/*.js"
end
s.subspec 'RCTSettings' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/Settings/*.{h,m}"
ss.preserve_paths = "Libraries/Settings/*.js"
end
s.subspec 'RCTText' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/Text/*.{h,m}"
ss.preserve_paths = "Libraries/Text/*.js"
end
s.subspec 'RCTVibration' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/Vibration/*.{h,m}"
ss.preserve_paths = "Libraries/Vibration/*.js"
end
s.subspec 'RCTWebSocket' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/WebSocket/*.{h,m}"
ss.preserve_paths = "Libraries/WebSocket/*.js"
end
s.subspec 'RCTLinkingIOS' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/LinkingIOS/*.{h,m}"
ss.preserve_paths = "Libraries/LinkingIOS/*.js"
end
s.subspec 'RCTTest' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/RCTTest/**/*.{h,m}"
ss.preserve_paths = "Libraries/RCTTest/**/*.js"
ss.frameworks = "XCTest"
end
end
... ...
... ... @@ -179,9 +179,9 @@ const ScrollView = React.createClass({
]),
/**
* When false, tapping outside of the focused text input when the keyboard
* is up dismisses the keyboard. When true, the scroll view will not catch
* taps, and the keyboard will not dismiss automatically. The default value
* is false.
* is up dismisses the keyboard. When true, the keyboard will not dismiss
* automatically, and the scroll view will not catch taps, but children of
* the scroll view can catch taps. The default value is false.
*/
keyboardShouldPersistTaps: PropTypes.bool,
/**
... ...
... ... @@ -474,6 +474,31 @@ class NavBar extends React.Component {
return img;
}
getNavBarBackgroundColor(channel) {
let color = '#3e3e3e';
switch (parseInt(channel)) {
case 1:
color = '#3e3e3e';
break;
case 2:
color = '#fe5c9a';
// color = '#f54683';
break;
case 3:
color = '#7edaf8';
// color = '#69cdef';
break;
case 4:
color = '#4a3b31';
// color = '#2a180e';
break;
case 5:
color = 'white';
break;
}
return color;
}
render() {
let state = this.props.navigationState;
let selected = state.children[state.index];
... ... @@ -499,9 +524,11 @@ class NavBar extends React.Component {
let opacityStyle = null;
if (channel == 2 || channel == 3 || channel == 4) {
opacityStyle = {opacity: 0.85};
// opacityStyle = {opacity: 0.85};
}
let backgroundColorStyle = {backgroundColor: this.getNavBarBackgroundColor(channel)};
// yoho
if (channel == 5) {
return (
... ... @@ -511,6 +538,7 @@ class NavBar extends React.Component {
this.props.navigationBarStyle,
state.navigationBarStyle,
selected.navigationBarStyle,
backgroundColorStyle,
]}
>
{renderTitle ? renderTitle(navProps) : state.children.map(this.renderTitle, this)}
... ... @@ -528,16 +556,12 @@ class NavBar extends React.Component {
state.navigationBarStyle,
selected.navigationBarStyle,
opacityStyle,
backgroundColorStyle,
]}
>
<Image
source={this.getNavBarBackgroundImage(channel)}
style={styles.image}
>
{renderTitle ? renderTitle(navProps) : state.children.map(this.renderTitle, this)}
{renderBackButton(navProps) || renderLeftButton(navProps)}
{renderRightButton(navProps)}
</Image>
</Animated.View>
);
}
... ...
... ... @@ -13,9 +13,9 @@
"moment": "^2.13.0",
"object-assign": "^4.1.0",
"query-string": "^4.2.2",
"react": "15.2.1",
"react": "15.3.0",
"react-immutable-proptypes": "^1.7.1",
"react-native": "0.30.0",
"react-native": "0.32.0",
"react-native-device-info": "^0.9.3",
"react-native-fabric": "0.2.2",
"react-native-progress": "^3.0.1",
... ...