Skip to content

Commit

Permalink
修复新版留言板的消息无法跳转的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
smallpath committed May 21, 2017
1 parent a317bc9 commit a51b4a5
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 26 deletions.
8 changes: 4 additions & 4 deletions psnine/container/shared/MessageItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export default class ComplexComment extends React.PureComponent {

return (
<View key={rowData.id} style={{
/*borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: modeInfo.brighterLevelOne,*/
marginVertical: 3.5
marginVertical: 3.5,
elevation: 1,
backgroundColor: modeInfo.backgroundColor
}}>
<TouchableNativeFeedback
onPress={() => onPress(rowData)}
Expand Down Expand Up @@ -111,6 +111,6 @@ const styles = StyleSheet.create({
},
a: {
fontWeight: '300',
color: idColor, // make links coloured pink
color: accentColor, // make links coloured pink
},
});
4 changes: 2 additions & 2 deletions psnine/container/shared/SimpleComment.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {

let screen = Dimensions.get('window');
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = screen;
export default class ComplexComment extends React.PureComponent {
export default class extends React.PureComponent {

constructor(props) {
super(props)
Expand Down Expand Up @@ -116,7 +116,7 @@ export default class ComplexComment extends React.PureComponent {
{ url }
]
})}
imagePaddingOffset={30 + 50}
imagePaddingOffset={30 + 50 + 10}
/>

<View style={{ flex: 1.1, flexDirection: 'row', justifyContent: 'space-between' }}>
Expand Down
4 changes: 2 additions & 2 deletions psnine/container/user/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ class Message extends Component {
} else if (URL.includes('/qa/')) {
type = 'QaTopic'
replyType = 'qa'
} else if (URL.includes('/psnid/') && URL.includes('/comment')) {
} else if (URL.includes('/psnid/') && URL.includes('#comment')) {
type = 'Home'
replyType = ''
navigation.navigate(type, {
URL: URL.replace('/comment', ''),
URL: URL.replace(/#comment-\d+$/, ''),
title: rowData.psnid
});
return
Expand Down
2 changes: 1 addition & 1 deletion psnine/parser/user/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function (html) {
return $(this).text()
}))[1]
const text = $this.text()
let content = $this.find('.content').html()
let content = $this.find('.content').html().replace(/<a.*?class="font12 r">.*?<\/a>/, '')
const psnid = $this.find('a.psnnode').text()
const url = $this.find('a.psnnode').prev().attr('href')
const matchedComment = url.match(/comment\-(\d+)$/)
Expand Down
10 changes: 4 additions & 6 deletions psnine/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@ class Root extends React.Component {
constructor(props) {
super(props);

// let hour = ~~moment().format('HH');

this.state = {
text: '',
isNightMode: false,//hour >= 22 || hour < 7,
isNightMode: false,
tipBarMarginBottom: new Animated.Value(0),
progress: new Animated.Value(0),
isLoadingAsyncStorage: true,
Expand All @@ -64,7 +62,7 @@ class Root extends React.Component {
},
isNightMode: false
},
loadingText: '\n正在加载配置'
loadingText: 'PSNINE\nP9 · 酷玩趣友'
};

this.dayModeInfo = {
Expand Down Expand Up @@ -227,15 +225,15 @@ class Root extends React.Component {
ref={animation => { this.animation = animation; }}
style={{
width: SCREEN_WIDTH,
height: SCREEN_HEIGHT - StatusBar.currentHeight * 3,
height: SCREEN_HEIGHT - StatusBar.currentHeight * 6,
}}
progress={progress}
source={require('./animations/LottieLogo1.json')}
/>
<Text numberOfLines={2} style={{
position: 'absolute',
left: 0,
top: SCREEN_HEIGHT/2,
top: SCREEN_HEIGHT / 10 * 1,
textAlign: 'center',
textAlignVertical: 'center',
right: 0,
Expand Down
17 changes: 6 additions & 11 deletions psnine/utils/transitionConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,11 @@ export function transitionConfig(

let index = scene.index;

// transitionConfig拿不到上一次的过渡属性, 得靠onTransitionStart来hack一下
const prev = hack.prevTransitionProps.scenes && hack.prevTransitionProps.scenes[index + 1]
let prev = hack.prevTransitionProps.scenes && hack.prevTransitionProps.scenes[index + 1]

if (scene && scene.isActive && prev && prev.route) {
// 退出时, 如果这个界面是Active且之前的界面有shouldSeeBackground属性, 那么定死1以避免白色闪屏
if (prev.route.params && prev.route.params.shouldSeeBackground === true) {
if (scene && prev && prev.route) {
const shouldSet = prev.route.params && prev.route.params.shouldSeeBackground === true
if (scene.isActive && shouldSet) {
return {
opacity: 1
}
Expand All @@ -72,11 +71,7 @@ export function transitionConfig(
const params = (navigation.state.routes[navigation.state.index] || {}).params || {}

if (params.shouldSeeBackground === true) {
if (scene.index === navigation.state.index) {
return {
opacity: 1
}
} else if (scene.index + 1 == navigation.state.index) {
if (scene.index + 1 >= navigation.state.index) {
return {
opacity: 1
}
Expand All @@ -93,7 +88,7 @@ export function transitionConfig(
const translateX = 0;
const translateY = position.interpolate({
inputRange,
outputRange: ([SCREEN_WIDTH, 0, 0, 0]),
outputRange: ([SCREEN_WIDTH/2, 0, 0, 0]),
});

return {
Expand Down

0 comments on commit a51b4a5

Please sign in to comment.