Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
BasicApp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
施贇杰
BasicApp
Commits
701fd579
Commit
701fd579
authored
Jun 21, 2019
by
shiyunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
props push
parent
fe40ad0f
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
56 additions
and
64 deletions
+56
-64
UserInterfaceState.xcuserstate
...data/shiyunjie.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
actions.js
src/BasicNavigator/actions.js
+2
-1
navigationStack.js
src/BasicNavigator/navigationStack.js
+6
-0
reducer.js
src/BasicNavigator/reducer.js
+4
-3
MainApp.js
src/MainApp.js
+1
-0
index.js
src/changeThemePage/index.js
+10
-0
index.js
src/components/NavigationBar/index.js
+0
-2
FramePage.js
src/home/FramePage.js
+3
-2
JSComponentList.js
src/home/JSComponentList.js
+1
-1
JSPage.js
src/jsComponent/JSPage.js
+18
-11
NativePage.js
src/nativeComponent/NativePage.js
+8
-6
ApplicationStyles.js
src/theme/ApplicationStyles.js
+2
-2
Colors.js
src/theme/Colors.js
+1
-1
versionCheck.js
src/utils/versionCheck.js
+0
-35
No files found.
ios/BasicApp.xcodeproj/project.xcworkspace/xcuserdata/shiyunjie.xcuserdatad/UserInterfaceState.xcuserstate
View file @
701fd579
No preview for this file type
src/BasicNavigator/actions.js
View file @
701fd579
...
@@ -7,9 +7,10 @@ export const PUSH = 'push';
...
@@ -7,9 +7,10 @@ export const PUSH = 'push';
export
const
POP
=
'pop'
;
export
const
POP
=
'pop'
;
export
const
TAB
=
'tab'
;
export
const
TAB
=
'tab'
;
// action creator
// action creator
export
const
push
=
(
pageName
:
String
=
''
)
=>
({
export
const
push
=
(
pageName
:
String
=
''
,
extProps
)
=>
({
type
:
PUSH
,
type
:
PUSH
,
pageName
,
pageName
,
extProps
,
});
});
export
const
pop
=
(
pageName
:
String
=
''
)
=>
({
export
const
pop
=
(
pageName
:
String
=
''
)
=>
({
type
:
POP
,
type
:
POP
,
...
...
src/BasicNavigator/navigationStack.js
View file @
701fd579
...
@@ -84,6 +84,12 @@ const navigator = createStackNavigator({
...
@@ -84,6 +84,12 @@ const navigator = createStackNavigator({
},
{
},
{
initialRouteName
,
initialRouteName
,
headerMode
:
'none'
,
headerMode
:
'none'
,
defaultNavigationOptions
:
{
gesturesEnabled
:
false
,
},
disableKeyboardHandling
:
false
,
cardShadowEnabled
:
true
,
cardOverlayEnabled
:
true
,
});
});
//export default navigator;
//export default navigator;
...
...
src/BasicNavigator/reducer.js
View file @
701fd579
...
@@ -10,17 +10,18 @@ import { PUSH, POP, TAB } from './actions';
...
@@ -10,17 +10,18 @@ import { PUSH, POP, TAB } from './actions';
const
ActionForTab
=
NavigationStack
.
router
.
getActionForPathAndParams
(
initialRouteName
);
const
ActionForTab
=
NavigationStack
.
router
.
getActionForPathAndParams
(
initialRouteName
);
const
ActionForNativePage
=
pageName
=>
NavigationStack
.
router
.
getActionForPathAndParams
(
pageName
);
const
ActionForNativePage
=
action
=>
NavigationStack
.
router
.
getActionForPathAndParams
(
action
.
pageName
,
action
.
extProps
);
const
initialState
=
NavigationStack
.
router
.
getStateForAction
(
ActionForTab
);
const
initialState
=
NavigationStack
.
router
.
getStateForAction
(
ActionForTab
);
const
nav
=
(
state
=
initialState
,
action
)
=>
{
const
nav
=
(
state
=
initialState
,
action
)
=>
{
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
case
PUSH
:
case
PUSH
:
return
NavigationStack
.
router
.
getStateForAction
(
ActionForNativePage
(
action
.
pageName
),
state
);
return
NavigationStack
.
router
.
getStateForAction
(
ActionForNativePage
(
action
),
state
);
case
POP
:
case
POP
:
if
(
action
.
pageName
)
{
if
(
action
.
pageName
)
{
return
NavigationStack
.
router
.
getStateForAction
(
ActionForNativePage
(
action
.
pageName
),
state
);
return
NavigationStack
.
router
.
getStateForAction
(
ActionForNativePage
(
action
),
state
);
}
}
return
NavigationStack
.
router
.
getStateForAction
(
NavigationActions
.
back
(),
state
);
return
NavigationStack
.
router
.
getStateForAction
(
NavigationActions
.
back
(),
state
);
case
TAB
:
case
TAB
:
...
...
src/MainApp.js
View file @
701fd579
...
@@ -38,6 +38,7 @@ class MainApp extends Component {
...
@@ -38,6 +38,7 @@ class MainApp extends Component {
//console.log('handleAppChange:')
//console.log('handleAppChange:')
if
(
currentAppState
===
'active'
)
{
if
(
currentAppState
===
'active'
)
{
//checkForUpdate(true)
//checkForUpdate(true)
console
.
log
(
'handleAppChange'
,
'active'
);
}
}
}
}
...
...
src/changeThemePage/index.js
View file @
701fd579
...
@@ -21,6 +21,7 @@ import themeAction from '../theme/action';
...
@@ -21,6 +21,7 @@ import themeAction from '../theme/action';
import
NavigationBar
from
'../components/NavigationBar'
;
import
NavigationBar
from
'../components/NavigationBar'
;
import
BackButton
from
'../components/BackButton'
;
import
BackButton
from
'../components/BackButton'
;
import
Button
from
'../components/ThemeButton'
;
import
Button
from
'../components/ThemeButton'
;
import
{
NavigationEvents
}
from
"react-navigation"
;
type
Props
=
{};
type
Props
=
{};
const
styles
=
StyleSheet
.
create
({
const
styles
=
StyleSheet
.
create
({
...
@@ -37,8 +38,11 @@ const styles = StyleSheet.create({
...
@@ -37,8 +38,11 @@ const styles = StyleSheet.create({
class
ThemePage
extends
Component
<
Props
>
{
class
ThemePage
extends
Component
<
Props
>
{
render
()
{
render
()
{
const
{
theme
,
setCurrentTheme
}
=
this
.
props
;
const
{
theme
,
setCurrentTheme
}
=
this
.
props
;
console
.
log
(
'ThemePage:'
,
this
.
props
)
this
.
props
.
navigation
.
isFirstRouteInParent
()
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
NavigationBar
<
NavigationBar
...
@@ -66,6 +70,12 @@ class ThemePage extends Component<Props> {
...
@@ -66,6 +70,12 @@ class ThemePage extends Component<Props> {
}}
}}
title
=
"切换红色主题"
title
=
"切换红色主题"
/>
/>
<
NavigationEvents
onWillFocus
=
{
payload
=>
console
.
log
(
'onWillFocus'
,
payload
)}
onDidFocus
=
{()
=>
console
.
log
(
'onDidFocus'
)}
onWillBlur
=
{
payload
=>
console
.
log
(
'onWillBlur'
,
payload
)}
onDidBlur
=
{
payload
=>
console
.
log
(
'onDidBlur'
,
payload
)}
/
>
<
/View
>
<
/View
>
);
);
}
}
...
...
src/components/NavigationBar/index.js
View file @
701fd579
...
@@ -36,8 +36,6 @@ const styles = StyleSheet.create({
...
@@ -36,8 +36,6 @@ const styles = StyleSheet.create({
androidPad
:
{
androidPad
:
{
height
:
88
,
height
:
88
,
},
},
backgroundColor
:
'#0074E1'
,
// backgroundColor: 'rgb(42,85,161)',
flexDirection
:
'row'
,
flexDirection
:
'row'
,
},
},
left
:
{
left
:
{
...
...
src/home/FramePage.js
View file @
701fd579
...
@@ -81,6 +81,7 @@ Row
...
@@ -81,6 +81,7 @@ Row
);
);
render
()
{
render
()
{
const
{
theme
}
=
this
.
props
const
data
=
[];
const
data
=
[];
for
(
let
section
=
1
;
section
<=
10
;
section
+=
1
)
{
for
(
let
section
=
1
;
section
<=
10
;
section
+=
1
)
{
const
sContent
=
{
items
:
[]
};
const
sContent
=
{
items
:
[]
};
...
@@ -90,7 +91,7 @@ Row
...
@@ -90,7 +91,7 @@ Row
data
.
push
(
sContent
);
data
.
push
(
sContent
);
}
}
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
theme
.
container
}
>
<
NavigationBar
<
NavigationBar
title
=
"Frame"
title
=
"Frame"
/>
/>
...
@@ -100,7 +101,7 @@ Row
...
@@ -100,7 +101,7 @@ Row
title
=
"Frame"
title
=
"Frame"
/>
/>
<
LargeList
<
LargeList
style
=
{
styles
.
container
}
style
=
{
{
height
:
SCREEN_HEIGHT
,
backgroundColor
:
'yellow'
}
}
data
=
{
data
}
data
=
{
data
}
heightForSection
=
{()
=>
50
}
heightForSection
=
{()
=>
50
}
renderSection
=
{
this
.
_renderSection
}
renderSection
=
{
this
.
_renderSection
}
...
...
src/home/JSComponentList.js
View file @
701fd579
...
@@ -38,7 +38,7 @@ class JSComponentList extends Component<Props> {
...
@@ -38,7 +38,7 @@ class JSComponentList extends Component<Props> {
console
.
log
(
'MainPage'
,
this
.
props
);
console
.
log
(
'MainPage'
,
this
.
props
);
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
TouchableOpacity
onPress
=
{()
=>
{
this
.
props
.
push
(
'JSPage'
);
}}
>
<
TouchableOpacity
onPress
=
{()
=>
{
this
.
props
.
push
(
'JSPage'
,
{
test
:
1
}
);
}}
>
<
Text
style
=
{
styles
.
instructions
}
>
JSComponentList
<
/Text
>
<
Text
style
=
{
styles
.
instructions
}
>
JSComponentList
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
...
...
src/jsComponent/JSPage.js
View file @
701fd579
...
@@ -10,35 +10,42 @@ import React, { Component } from 'react';
...
@@ -10,35 +10,42 @@ import React, { Component } from 'react';
import
{
import
{
Platform
,
StyleSheet
,
Text
,
View
,
TouchableOpacity
,
Platform
,
StyleSheet
,
Text
,
View
,
TouchableOpacity
,
}
from
'react-native'
;
}
from
'react-native'
;
import
{
NavigationEvents
,
withNavigationFocus
}
from
'react-navigation'
;
import
{
compose
}
from
'redux'
;
import
{
compose
}
from
'redux'
;
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
{
push
,
tab
}
from
'../BasicNavigator/actions'
;
import
{
push
,
tab
}
from
'../BasicNavigator/actions'
;
import
NavigationBar
from
'../components/NavigationBar'
;
import
BackButton
from
'../components/BackButton'
;
type
Props
=
{};
type
Props
=
{};
class
JSPage
extends
Component
<
Props
>
{
function
JSPage
(
props
)
{
render
()
{
console
.
log
(
'JSPage_props:'
,
props
)
console
.
log
(
'JSPage'
,
this
.
props
);
//console.log('JSPage props from lastPage', this.props.navigation.state
);
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
TouchableOpacity
onPress
=
{()
=>
{
this
.
props
.
push
(
'NativePage'
);
}}
>
<
NavigationBar
left
=
{
<
BackButton
/>
}
title
=
"ThemeDemo"
/>
<
TouchableOpacity
onPress
=
{()
=>
{
props
.
push
(
'NativePage'
,{
may
:
'22'
});
}}
>
<
Text
style
=
{
styles
.
instructions
}
>
JSPage
<
/Text
>
<
Text
style
=
{
styles
.
instructions
}
>
JSPage
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
TouchableOpacity
onPress
=
{()
=>
{
this
.
props
.
tab
(
'ServicePage'
);
}}
>
<
TouchableOpacity
onPress
=
{()
=>
{
props
.
tab
(
'ServicePage'
);
}}
>
<
Text
style
=
{
styles
.
instructions
}
>
Tab
切换
<
/Text
>
<
Text
style
=
{
styles
.
instructions
}
>
Tab
切换
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
);
);
}
}
}
const
styles
=
StyleSheet
.
create
({
const
styles
=
StyleSheet
.
create
({
container
:
{
container
:
{
flex
:
1
,
flex
:
1
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
backgroundColor
:
'#F5FCFF'
,
backgroundColor
:
'#F5FCFF'
,
},
},
welcome
:
{
welcome
:
{
...
@@ -52,8 +59,8 @@ const styles = StyleSheet.create({
...
@@ -52,8 +59,8 @@ const styles = StyleSheet.create({
marginBottom
:
5
,
marginBottom
:
5
,
},
},
});
});
function
propsMapping
(
props
,
extProps
)
{
function
propsMapping
(
props
)
{
const
{
nav
}
=
props
const
{
nav
}
=
props
;
return
{
return
{
nav
,
nav
,
};
};
...
...
src/nativeComponent/NativePage.js
View file @
701fd579
...
@@ -13,6 +13,8 @@ import {
...
@@ -13,6 +13,8 @@ import {
import
{
compose
}
from
'redux'
;
import
{
compose
}
from
'redux'
;
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
{
pop
}
from
'../BasicNavigator/actions'
;
import
{
pop
}
from
'../BasicNavigator/actions'
;
import
NavigationBar
from
'../components/NavigationBar'
;
import
BackButton
from
'../components/BackButton'
;
type
Props
=
{
type
Props
=
{
routes
:
Array
,
routes
:
Array
,
...
@@ -20,10 +22,13 @@ type Props = {
...
@@ -20,10 +22,13 @@ type Props = {
};
};
class
NativePage
extends
Component
<
Props
>
{
class
NativePage
extends
Component
<
Props
>
{
render
()
{
render
()
{
console
.
log
(
'NativePage'
,
this
.
props
);
//console.log('NativePage props from lastPage', this.props.navigation.state
);
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
NavigationBar
left
=
{
<
BackButton
/>
}
title
=
"ThemeDemo"
/>
<
Text
style
=
{
styles
.
instructions
}
>
NativePage
<
/Text
>
<
Text
style
=
{
styles
.
instructions
}
>
NativePage
<
/Text
>
<
TouchableOpacity
onPress
=
{()
=>
{
<
TouchableOpacity
onPress
=
{()
=>
{
...
@@ -43,8 +48,6 @@ class NativePage extends Component<Props> {
...
@@ -43,8 +48,6 @@ class NativePage extends Component<Props> {
const
styles
=
StyleSheet
.
create
({
const
styles
=
StyleSheet
.
create
({
container
:
{
container
:
{
flex
:
1
,
flex
:
1
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
backgroundColor
:
'#F5FCFF'
,
backgroundColor
:
'#F5FCFF'
,
},
},
welcome
:
{
welcome
:
{
...
@@ -58,8 +61,7 @@ const styles = StyleSheet.create({
...
@@ -58,8 +61,7 @@ const styles = StyleSheet.create({
marginBottom
:
5
,
marginBottom
:
5
,
},
},
});
});
function
propsMapping
(
props
,
extProps
)
{
function
propsMapping
(
props
)
{
console
.
log
(
extProps
);
const
{
nav
}
=
props
;
const
{
nav
}
=
props
;
return
{
return
{
routes
:
nav
?
nav
.
routes
:
[],
routes
:
nav
?
nav
.
routes
:
[],
...
...
src/theme/ApplicationStyles.js
View file @
701fd579
...
@@ -20,8 +20,8 @@ const ApplicationStyles = {
...
@@ -20,8 +20,8 @@ const ApplicationStyles = {
},
},
container
:
{
container
:
{
flex
:
1
,
flex
:
1
,
paddingTop
:
Metrics
.
baseMargin
,
//
paddingTop: Metrics.baseMargin,
backgroundColor
:
Colors
.
transparent
,
backgroundColor
:
Colors
.
background
,
},
},
section
:
{
section
:
{
margin
:
Metrics
.
section
,
margin
:
Metrics
.
section
,
...
...
src/theme/Colors.js
View file @
701fd579
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
* charcoal : string, text : string, eggplant : string, ricePaper : string}}
* charcoal : string, text : string, eggplant : string, ricePaper : string}}
*/
*/
const
colors
=
{
const
colors
=
{
background
:
'#
1F0808
'
,
background
:
'#
F4F5F5
'
,
clear
:
'rgba(0,0,0,0)'
,
clear
:
'rgba(0,0,0,0)'
,
facebook
:
'#3b5998'
,
facebook
:
'#3b5998'
,
transparent
:
'rgba(0,0,0,0)'
,
transparent
:
'rgba(0,0,0,0)'
,
...
...
src/utils/versionCheck.js
deleted
100644 → 0
View file @
fe40ad0f
/**
* @flow
*
*/
type
Result
=
"GREATER_THEN"
|
"EQUAL"
|
"LESS_THEN"
export
const
GREATER_THEN
=
'GREATER_THEN'
export
const
EQUAL
=
'EQUAL'
export
const
LESS_THEN
=
'LESS_THEN'
export
function
versionCheck
(
currentVersionString
:
string
,
targetVersionString
:
string
):
Result
{
function
numberialVersion
(
versionText
)
{
return
versionText
.
split
(
'.'
).
map
((
i
)
=>
parseInt
(
i
,
10
))
}
function
compare
(
currentVersion
,
targetVersion
)
{
const
[
current
,
...
restCurrent
]
=
currentVersion
const
[
target
,
...
restTarget
]
=
targetVersion
if
(
current
==
null
&&
target
==
null
)
{
return
EQUAL
}
if
(
current
===
target
)
{
return
compare
(
restCurrent
,
restTarget
)
}
if
(
current
>
target
)
return
GREATER_THEN
return
LESS_THEN
}
return
compare
(
numberialVersion
(
currentVersionString
),
numberialVersion
(
targetVersionString
),
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment