Skip to content

Commit

Permalink
[#5] feat - creating marker modal
Browse files Browse the repository at this point in the history
Co-authored-by: Alexandre Miguel <aleronupe@gmail.com>
  • Loading branch information
gdeusdara and aleronupe committed Sep 8, 2021
1 parent b738100 commit b1a6a66
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/components/CreatePointModal/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React, {useRef, useMemo} from 'react';
import BottomSheet, {BottomSheetScrollView} from '@gorhom/bottom-sheet';
import PropTypes from 'prop-types';
import {Text, Btn} from 'components/UI';
import theme from 'theme/theme';

import {Container, Option} from './styles';

const CreatePoint = ({locationSelected}) => {
const snapPoints = useMemo(() => ['50%', '90%'], []);
const sheetRef = useRef(null);

const onSave = () => {
return locationSelected;
};

return (
<>
<Container>
<Option size={50} onPress={() => sheetRef.current.snapToIndex(0)}>
<Text color={theme.colors.white}>Teste</Text>
</Option>
</Container>
<BottomSheet ref={sheetRef} index={1} snapPoints={snapPoints}>
<BottomSheetScrollView>
<Text>Teste</Text>
<Btn onPress={onSave} title="Salvar ponto" />
</BottomSheetScrollView>
</BottomSheet>
</>
);
};

CreatePoint.propTypes = {
locationSelected: PropTypes.shape({
latitude: PropTypes.string,
longitude: PropTypes.func,
}),
};

CreatePoint.defaultProps = {
locationSelected: {},
};

export default CreatePoint;
29 changes: 29 additions & 0 deletions src/components/CreatePointModal/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import styled from 'styled-components/native';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome5';
import theme from 'theme/theme';

export const Icon = styled(FontAwesomeIcon).attrs({
color: theme.colors.white,
})``;

export const Container = styled.View`
position: absolute;
right: 0;
bottom: 0;
left: 0;
margin: 20px;
align-items: center;
justify-content: center;
`;

export const Option = styled.TouchableHighlight.attrs({
underlayColor: theme.colors.secondary,
})`
border-radius: 100px;
width: ${({size}) => size}px;
height: ${({size}) => size}px;
background-color: ${theme.colors.primary};
align-items: center;
justify-content: center;
margin: 5px;
`;

0 comments on commit b1a6a66

Please sign in to comment.