-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from Gauravjeetsingh/add-sidebar-menu
Add sidebar menu with larivaar assist option
- Loading branch information
Showing
13 changed files
with
586 additions
and
70 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
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,3 +1,4 @@ | ||
module.exports = { | ||
presets: ['module:metro-react-native-babel-preset'], | ||
plugins: ['react-native-reanimated/plugin'], | ||
}; |
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,6 +1,5 @@ | ||
export interface AngProps { | ||
page: number; | ||
larivaarAssist: boolean; | ||
} | ||
|
||
export interface AngData { | ||
|
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 React, {useRef, useState} from 'react'; | ||
import 'react-native-gesture-handler'; | ||
import { | ||
Button, | ||
SafeAreaView, | ||
ScrollView, | ||
StatusBar, | ||
TextInput, | ||
useColorScheme, | ||
View, | ||
} from 'react-native'; | ||
|
||
import {Ang} from '../../components'; | ||
import {layoutStyles, elementStyles} from '../../styles'; | ||
|
||
const Launchpad = (): JSX.Element => { | ||
const isDarkMode = useColorScheme() === 'dark'; | ||
const textInputRef = useRef<TextInput>(null); | ||
|
||
const [inputAng, setInputAng] = useState(1); | ||
return ( | ||
<SafeAreaView> | ||
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} /> | ||
<ScrollView contentInsetAdjustmentBehavior="automatic"> | ||
<View style={layoutStyles.mainContainer}> | ||
<View style={layoutStyles.header}> | ||
<Button | ||
title="Previous" | ||
onPress={() => { | ||
setInputAng(inputAng - 1); | ||
textInputRef.current?.setNativeProps({ | ||
text: (inputAng - 1).toString(), | ||
}); | ||
}} | ||
/> | ||
<TextInput | ||
placeholder="Enter Ang Number" | ||
ref={textInputRef} | ||
style={elementStyles.input} | ||
defaultValue={inputAng.toString()} | ||
onSubmitEditing={event => { | ||
setInputAng(parseInt(event.nativeEvent.text, 10)); | ||
}} | ||
/> | ||
<Button | ||
title="Next" | ||
onPress={() => { | ||
setInputAng(inputAng + 1); | ||
textInputRef.current?.setNativeProps({ | ||
text: (inputAng + 1).toString(), | ||
}); | ||
}} | ||
/> | ||
</View> | ||
|
||
<Ang page={inputAng} /> | ||
</View> | ||
</ScrollView> | ||
</SafeAreaView> | ||
); | ||
}; | ||
|
||
export default Launchpad; |
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,28 @@ | ||
import React, {useContext} from 'react'; | ||
import {View, Text, Switch, Button} from 'react-native'; | ||
import {layoutStyles} from '../../styles/layout'; | ||
import {LarivaarContext} from '../../context'; | ||
|
||
interface navigationProps { | ||
navigation: { | ||
closeDrawer: () => void; | ||
}; | ||
} | ||
|
||
const Settings = ({navigation}: navigationProps): JSX.Element => { | ||
const {larivaarAssist, setLarivaarAssist} = useContext(LarivaarContext); | ||
return ( | ||
<> | ||
<View style={layoutStyles.sidebar}> | ||
<Text>Larivaar Assist</Text> | ||
<Switch | ||
value={larivaarAssist} | ||
onChange={() => setLarivaarAssist(!larivaarAssist)} | ||
/> | ||
</View> | ||
<Button title="Go Back" onPress={() => navigation.closeDrawer()} /> | ||
</> | ||
); | ||
}; | ||
|
||
export default Settings; |
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,5 @@ | ||
import Ang from './Ang'; | ||
import Settings from './Settings/setting'; | ||
import Launchpad from './Launchpad/lauchpad'; | ||
|
||
export {Ang, Settings, Launchpad}; |
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,6 @@ | ||
import {createContext} from 'react'; | ||
|
||
export const LarivaarContext = createContext({ | ||
larivaarAssist: false, | ||
setLarivaarAssist: (_larivaarAssist: boolean) => {}, | ||
}); |
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
Oops, something went wrong.