-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: refacto #62
fix: refacto #62
Conversation
|
||
import theme from "../../../theme/theme"; | ||
|
||
export default StyleSheet.create({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be we should return not a style but a styleCreator
export default ({mode, ...})=>{
return StyleSheet.create({
container:{
backgroundColor:theme[mode+"Color"],
}
})
}
we could even wrap it with a higher order function to add optimisations like memoization.
It could allow us may be to create dynamique styleSheet -> dynamique theme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use would be something like this
import styleSheetCreator from './styles'
...
render(){
const styles = styleSheetCreator({mode: this.props.mode, size:this.props.size})
return <MyComponent style={styles.toto} />
}
....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's compose all the things! I like this!
you can change the name i am not happy with it |
app/hocs/enhanceWithValidEntities.js
Outdated
@@ -5,10 +5,10 @@ import Loading from "../components/technical/loading/Loading"; | |||
import Faulty from "../components/technical/faulty/Faulty"; | |||
import { isFaulty, isLoading, getDefect } from "../dataDefinitions/defects"; | |||
|
|||
export default test => WrappedComponent => { | |||
export default entities => WrappedComponent => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getEntitiesToTest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bof bof!
app/routes/main/Main.js
Outdated
import ClubFeed from "./clubFeed/ClubFeed"; | ||
import PerformanceMeter from "./performanceMeter/PerformanceMeter"; | ||
import RacePredictor from "./race/Race"; | ||
import PerformanceMeter from "./athletePerformanceLevel/AthletePerformanceLevel"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:smile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! Half done!!
@@ -37,4 +37,4 @@ class PerformanceMeter extends Component { | |||
export default compose( | |||
enhanceWithValidEntities(({ athlete }) => [athlete]), | |||
connect(selector) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the selector to select progress
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dinno wha you wanna talk?
move performance stuff into slelector?
I would rather use optional chaining in component!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L 28
this.props.athlete.performance
? this.props.athlete.performance.value
: NaN
should be inside the selector
or moved inside progress
@@ -37,4 +37,4 @@ class PerformanceMeter extends Component { | |||
export default compose( | |||
enhanceWithValidEntities(({ athlete }) => [athlete]), | |||
connect(selector) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L 28
this.props.athlete.performance
? this.props.athlete.performance.value
: NaN
should be inside the selector
or moved inside progress
app/routes/main/Main.js
Outdated
@@ -2,32 +2,32 @@ import React from "react"; | |||
import { TabNavigator } from "react-navigation"; | |||
import { Icon } from "react-native-elements"; | |||
|
|||
import Details from "./athleteDetails/AthleteDetails"; | |||
import AthleteDetails from "./athleteDetails/AthleteDetails"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄
app/routes/main/Main.js
Outdated
import ClubFeed from "./clubFeed/ClubFeed"; | ||
import PerformanceMeter from "./athletePerformanceLevel/AthletePerformanceLevel"; | ||
import RacePredictor from "./clubEvents/ClubEvents"; | ||
import AthletePerformanceLevel from "./athletePerformanceLevel/AthletePerformanceLevel"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄
app/routes/main/Main.js
Outdated
import PerformanceMeter from "./athletePerformanceLevel/AthletePerformanceLevel"; | ||
import RacePredictor from "./clubEvents/ClubEvents"; | ||
import AthletePerformanceLevel from "./athletePerformanceLevel/AthletePerformanceLevel"; | ||
import ClubEvents from "./clubEvents/ClubEvents"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:smile
import theme from "../../theme/theme"; | ||
|
||
const Main = TabNavigator( | ||
{ | ||
PerformanceMeter: { | ||
screen: PerformanceMeter, | ||
AthletePerformanceLevel: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be we should write here
[AthletePerformanceLevel.name] : {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get your point!
No description provided.