forked from exponential-inc/lost-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
191 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import { Platform, StatusBar } from 'react-native'; | ||
import { Text, Layout } from '@ui-kitten/components'; | ||
|
||
import {HeaderText} from '../../Text/Header'; | ||
export const PageHeader = (props: {theme: any, title: string}) => { | ||
return ( | ||
<Layout | ||
style={{ | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
marginTop: 40, | ||
marginBottom: 5 | ||
}}> | ||
<StatusBar barStyle={props.theme === 'dark' ? 'light-content' : 'dark-content'}/> | ||
<Layout style={{paddingLeft: 20, paddingTop: 30, paddingBottom: 10}}> | ||
<HeaderText> | ||
{props.title} | ||
</HeaderText> | ||
</Layout> | ||
</Layout> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import {TouchableOpacity, ViewStyle} from 'react-native'; | ||
import {connect} from 'react-redux'; | ||
|
||
export const TouchableShadow = (props: { | ||
intensity?: number; | ||
children?: React.ReactNode; | ||
style?: ViewStyle; | ||
onPress?(): void; | ||
theme: String | ||
}) => { | ||
return ( | ||
<TouchableOpacity | ||
style={{ | ||
elevation: (props.intensity || 2) * 5, | ||
shadowColor: props.theme === 'dark' ? 'black' : 'grey', | ||
shadowOffset: {width: 0, height: 0}, | ||
shadowOpacity: 0.5, | ||
shadowRadius: (props.intensity || 1) * 3, | ||
...props.style, | ||
}} | ||
onPress={() => { | ||
if (props.onPress) { | ||
props.onPress(); | ||
} | ||
}}> | ||
{props.children} | ||
</TouchableOpacity> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
import {ViewStyle, View} from "react-native"; | ||
|
||
import {ThemeContext} from "../../../functions/theme"; | ||
|
||
export function ViewShadow(props: {intensity?: number; children?: React.ReactNode; style?: ViewStyle}) { | ||
return ( | ||
<ThemeContext.Consumer> | ||
{theme => | ||
<View style={{ | ||
elevation: (props.intensity || 2) * 5, | ||
shadowColor: theme.theme === 'light' ? "gray" : 'black', | ||
shadowOffset: {width: 0, height: 0}, | ||
shadowOpacity: 0.5, | ||
shadowRadius: (props.intensity || 1) * 3, | ||
...props.style | ||
}}> | ||
{props.children} | ||
</View>} | ||
</ThemeContext.Consumer> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import {Platform} from 'react-native'; | ||
import {Text} from '@ui-kitten/components'; | ||
|
||
export const BodyText = (props: {children?: string}) => { | ||
return ( | ||
<Text | ||
style={{ | ||
fontSize: 18, | ||
...Platform.select({ | ||
android: { | ||
fontFamily: 'Montserrat 500', | ||
}, | ||
ios: { | ||
fontFamily: 'Montserrat', | ||
fontWeight: '500', | ||
}, | ||
}), | ||
}}> | ||
{props.children ?? ''} | ||
</Text> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import {Platform} from 'react-native'; | ||
import {Text} from '@ui-kitten/components'; | ||
|
||
export const HeaderText = (props: {children?: string}) => { | ||
return ( | ||
<Text | ||
style={{ | ||
lineHeight: 30, | ||
fontSize: 30, | ||
...Platform.select({ | ||
android: { | ||
// fontFamily: 'Montserrat 700', | ||
}, | ||
ios: { | ||
// fontFamily: 'Montserrat-Regular', | ||
fontWeight: '700', | ||
}, | ||
}), | ||
}}> | ||
{props.children ?? ''} | ||
</Text> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,31 @@ | ||
import React from 'react'; | ||
import { View, Text } from 'react-native'; | ||
import { connect } from 'react-redux'; | ||
import {connect} from 'react-redux'; | ||
import {Layout, Text} from '@ui-kitten/components'; | ||
|
||
const HomePageC = () => { | ||
return ( | ||
<View> | ||
<Text style={{width: '100%', textAlign: 'center', paddingTop: 100}}>Home</Text> | ||
</View> | ||
) | ||
} | ||
|
||
const mapStateToProps = (state: Object) => { | ||
return { | ||
import {PageHeader} from '../../components/Page/PageHeader'; | ||
import {TouchableShadow} from '../../components/Shadow/Touchable'; | ||
|
||
} | ||
} | ||
const HomePageC = (props: any) => { | ||
return ( | ||
<Layout style={{height: '100%'}}> | ||
<PageHeader theme={props.theme} title="Home" /> | ||
<TouchableShadow theme={props.theme}> | ||
<Layout style={{marginHorizontal: 15}}> | ||
<Text>Hello</Text> | ||
</Layout> | ||
</TouchableShadow> | ||
</Layout> | ||
); | ||
}; | ||
|
||
const mapDispatchToProps = (dispatch: Object) => { | ||
const mapStateToProps = (state: any) => { | ||
return { | ||
theme: state.theme, | ||
}; | ||
}; | ||
|
||
} | ||
} | ||
const mapDispatchToProps = (dispatch: any) => { | ||
return {}; | ||
}; | ||
|
||
export const HomePage = connect(mapStateToProps, mapDispatchToProps)(HomePageC); | ||
export const HomePage = connect(mapStateToProps, mapDispatchToProps)(HomePageC); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,46 @@ | ||
import React from 'react'; | ||
import { Layout, Text, List, ListItem } from '@ui-kitten/components'; | ||
import { connect } from 'react-redux'; | ||
import { SafeAreaView } from 'react-native'; | ||
import {Layout, Text, List, ListItem} from '@ui-kitten/components'; | ||
import {connect} from 'react-redux'; | ||
import {SafeAreaView} from 'react-native'; | ||
|
||
const data = ['Theme', 'Password'] | ||
const SettingsPageC = () => { | ||
const renderItem = ({ item, index }) => ( | ||
<ListItem title={`${item} ${index + 1}`}/> | ||
import {PageHeader} from '../../components/Page/PageHeader'; | ||
|
||
const SettingsPageC = (props: any) => { | ||
const data = [ | ||
{ | ||
title: 'Toggle theme', | ||
onPress: () => { | ||
props.toggleTheme(); | ||
}, | ||
}, | ||
]; | ||
|
||
const renderItem = ({item, index}) => ( | ||
<ListItem title={`${item.title}`} onPress={item.onPress} /> | ||
); | ||
return ( | ||
<Layout style={{height: '100%'}}> | ||
<PageHeader title="Settings" theme={props.theme} /> | ||
<List data={data} renderItem={renderItem}> | ||
<Text>Hello</Text> | ||
</List> | ||
</Layout> | ||
) | ||
} | ||
); | ||
}; | ||
|
||
const mapStateToProps = (state: any) => { | ||
console.log(state.theme); | ||
return { | ||
theme: state.theme, | ||
}; | ||
}; | ||
|
||
const mapDispatchToProps = (dispatch: any) => { | ||
return { | ||
toggleTheme: () => dispatch({type: 'TOGGLE_THEME'}), | ||
}; | ||
}; | ||
|
||
} | ||
} | ||
|
||
export const SettingsPage = connect(mapStateToProps, mapDispatchToProps)(SettingsPageC); | ||
export const SettingsPage = connect( | ||
mapStateToProps, | ||
mapDispatchToProps, | ||
)(SettingsPageC); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters