-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
6c33aeb
commit 0e3720b
Showing
24 changed files
with
607 additions
and
181 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,24 +1,106 @@ | ||
import React, {useState} from 'react' | ||
import DropDownPicker from 'react-native-dropdown-picker' | ||
import {StyleSheet, Text, View} from 'react-native' | ||
import {Dropdown} from 'react-native-element-dropdown' | ||
import {Colors} from 'src/utils/constants' | ||
import SelectIcon from 'assets/images/svg/SelectIcon.svg' | ||
|
||
export default function App() { | ||
const [open, setOpen] = useState(false) | ||
const [value, setValue] = useState(null) | ||
const [items, setItems] = useState([ | ||
{label: 'Apple', value: 'apple'}, | ||
{label: 'Banana', value: 'banana'}, | ||
{label: 'Pear', value: 'pear'}, | ||
]) | ||
const data = [ | ||
{label: 'Item 1', value: '1', search: 'Item 1'}, | ||
{label: 'Item 2', value: '2', search: 'Item 2'}, | ||
{label: 'Item 3', value: '3', search: 'Item 3'}, | ||
{label: 'Item 4', value: '4', search: 'Item 4'}, | ||
{label: 'Item 5', value: '5', search: 'Item 5'}, | ||
{label: 'Item 6', value: '6', search: 'Item 6'}, | ||
{label: 'Item 7', value: '7', search: 'Item 7'}, | ||
{label: 'Item 8', value: '8', search: 'Item 8'}, | ||
] | ||
|
||
interface Props { | ||
label: string | ||
} | ||
|
||
const DropdownComponent = (props: Props) => { | ||
const [value, setValue] = useState<string>() | ||
const [isFocus, setIsFocus] = useState(false) | ||
|
||
const renderLabel = () => { | ||
if (value || isFocus) { | ||
return ( | ||
<Text style={[styles.label, isFocus && {color: 'blue'}]}> | ||
{props.label} | ||
</Text> | ||
) | ||
} | ||
return null | ||
} | ||
|
||
return ( | ||
<DropDownPicker | ||
open={open} | ||
value={value} | ||
items={items} | ||
setOpen={setOpen} | ||
setValue={setValue} | ||
dropDownDirection="BOTTOM" | ||
setItems={setItems} | ||
/> | ||
<View style={styles.container}> | ||
{renderLabel()} | ||
<Dropdown | ||
style={[styles.dropdown, isFocus && {borderColor: 'blue'}]} | ||
placeholderStyle={styles.placeholderStyle} | ||
selectedTextStyle={styles.selectedTextStyle} | ||
inputSearchStyle={styles.inputSearchStyle} | ||
iconStyle={styles.iconStyle} | ||
data={data} | ||
autoScroll | ||
maxHeight={300} | ||
minHeight={100} | ||
labelField="label" | ||
valueField="value" | ||
searchField="search" | ||
placeholder={!isFocus ? props.label : '...'} | ||
value={value} | ||
onFocus={() => setIsFocus(true)} | ||
onBlur={() => setIsFocus(false)} | ||
onChange={item => { | ||
setValue(item.value) | ||
setIsFocus(false) | ||
}} | ||
renderRightIcon={() => <SelectIcon />} | ||
/> | ||
</View> | ||
) | ||
} | ||
|
||
export default DropdownComponent | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
padding: 16, | ||
}, | ||
dropdown: { | ||
height: 50, | ||
borderColor: 'gray', | ||
borderWidth: 0.5, | ||
borderRadius: 8, | ||
paddingHorizontal: 8, | ||
}, | ||
icon: { | ||
marginRight: 5, | ||
}, | ||
label: { | ||
position: 'absolute', | ||
backgroundColor: Colors.GRAY_BACKDROP, | ||
left: 22, | ||
top: 8, | ||
zIndex: 999, | ||
paddingHorizontal: 8, | ||
fontSize: 14, | ||
}, | ||
placeholderStyle: { | ||
fontSize: 16, | ||
}, | ||
selectedTextStyle: { | ||
fontSize: 16, | ||
}, | ||
iconStyle: { | ||
width: 20, | ||
height: 20, | ||
}, | ||
inputSearchStyle: { | ||
height: 40, | ||
fontSize: 16, | ||
}, | ||
}) |
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,50 @@ | ||
import {StyleSheet, View} from 'react-native' | ||
import React from 'react' | ||
import {InputOutline} from 'react-native-input-outline' | ||
import {Colors} from 'src/utils/constants' | ||
|
||
interface Props { | ||
label: string | ||
} | ||
|
||
const CustomTextInput = (props: Props) => { | ||
const {label} = props | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<InputOutline | ||
style={styles.inputWrapper} | ||
placeholder={label} | ||
activeColor={Colors.PRIMARY} | ||
inactiveColor={Colors.GRAY_TEXT} | ||
placeholderTextColor={Colors.GRAY_TEXT} | ||
fontSize={16} | ||
backgroundColor={Colors.GRAY_BACKDROP} | ||
/> | ||
</View> | ||
) | ||
} | ||
|
||
export default CustomTextInput | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
width: '100%', | ||
height: 50, | ||
alignItems: 'center', | ||
marginVertical: 20, | ||
flexDirection: 'row', | ||
backgroundColor: Colors.GRAY_BACKDROP, | ||
}, | ||
inputWrapper: { | ||
borderRadius: 10, | ||
paddingHorizontal: 10, | ||
width: '90%', | ||
height: '100%', | ||
marginHorizontal: '5%', | ||
backgroundColor: Colors.GRAY_BACKDROP, | ||
}, | ||
unitLabel: { | ||
color: Colors.GRAY_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,63 @@ | ||
import {StyleSheet, Switch, Text, View} from 'react-native' | ||
import React, {useState} from 'react' | ||
import {scaleFont} from 'src/utils/constants/mixins' | ||
import { Colors } from 'src/utils/constants' | ||
interface Props { | ||
description: string | ||
} | ||
|
||
const PlaceHolderSwitch = (props: Props) => { | ||
const [isSelected, setIsSelected] = useState(false) | ||
const changeHandler = () => { | ||
setIsSelected(!isSelected) | ||
} | ||
return ( | ||
<View style={styles.container}> | ||
<View | ||
style={[ | ||
styles.inputWrapper, | ||
{ | ||
backgroundColor: isSelected | ||
? Colors.NEW_PRIMARY | ||
: Colors.GRAY_LIGHT, | ||
}, | ||
]}> | ||
<Text style={styles.inputLabel}>{props.description}</Text> | ||
<View style={styles.divider} /> | ||
<Switch | ||
value={isSelected} | ||
onValueChange={changeHandler} | ||
disabled={false} | ||
/> | ||
</View> | ||
</View> | ||
) | ||
} | ||
|
||
export default PlaceHolderSwitch | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
width: '100%', | ||
height: 60, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
marginVertical:10 | ||
}, | ||
inputWrapper: { | ||
borderRadius: 10, | ||
width: '95%', | ||
height: '100%', | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
paddingVertical: 7, | ||
}, | ||
inputLabel: { | ||
color: 'gray', | ||
fontSize: scaleFont(15), | ||
marginLeft: 10, | ||
}, | ||
divider: { | ||
flex: 1, | ||
}, | ||
}) |
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,35 @@ | ||
import {StyleSheet, Text, View} from 'react-native' | ||
import React from 'react' | ||
import { scaleSize } from 'src/utils/constants/mixins' | ||
import { Colors } from 'src/utils/constants' | ||
|
||
interface Props { | ||
lat: number | ||
long: number | ||
id: string | ||
} | ||
|
||
const DispalyCurrentPolygonMarker = (props: Props) => { | ||
const {id} = props | ||
return ( | ||
<View style={styles.container}> | ||
<Text style={styles.label}>Corner {id}</Text> | ||
<Text>Please select the next corner</Text> | ||
</View> | ||
) | ||
} | ||
|
||
export default DispalyCurrentPolygonMarker | ||
|
||
const styles = StyleSheet.create({ | ||
container:{ | ||
width:'100%', | ||
height:scaleSize(50), | ||
backgroundColor:Colors.WHITE, | ||
paddingHorizontal:20 | ||
}, | ||
label:{ | ||
fontSize: 18, | ||
fontWeight:'600' | ||
} | ||
}) |
Oops, something went wrong.