Comments (4)
@forumics Are those links correct? They are bringing me back to the github issues.
from react-native-elements.
apologies for the links, they are not supposed to be there
I've tried to make something like that myself, can refer to the following code.
Do note that it is to be used as the menu component with react native side drawer
https://github.com/root-two/react-native-drawer
from react-native-elements.
import React, { Component } from 'react';
import {
Dimensions,
StyleSheet,
ScrollView,
Image,
Navigator,
TouchableWithoutFeedback,
Animated,
Easing,
View,
Text
} from 'react-native';
const window = Dimensions.get('window');
export default class Menu extends Component {
constructor(props)
{
super(props);
this.animatedValue = new Animated.Value(0);
this.state = {
range1: 10,range2: -300,
range3: 300,range4: 10,
range5: 300,range6: 10,
display: 'main'
};
}
animate() {
this.animatedValue.setValue(0)
Animated.timing(
this.animatedValue,
{
toValue: 2,
duration: 500,
easing: Easing.in(Easing.ease),
}
).start()
}
startAnimation(item)
{
if (this.state.display=='main' && item==1)
{
this.setState({range1:10, range2:-300, range3: 300, range4: 10, range5: 300, range6: 300, display: 'secondary'});
this.animate();
}
if (this.state.display=='secondary' && item==1)
{
this.setState({range1:-300, range2:10, range3: 10, range4: 300, range5: 300, range6: 300, display:'main'});
this.animate();
}
if (this.state.display=='main' && item==2)
{
this.setState({range1:10, range2:-300,range3: 300,range4: 300, range5: 300, range6: 10, display: 'secondary'});
this.animate();
}
if (this.state.display=='secondary' && item==2)
{
this.setState({range1:-300, range2:10,range3: 300,range4: 300, range5: 10, range6: 300, display:'main'});
this.animate();
}
}
render() {
var mainMenu = this.animatedValue.interpolate({
inputRange: [0, 1,2],
outputRange: [this.state.range1, this.state.range2+5,this.state.range2]
})
var subMenu1 = this.animatedValue.interpolate({
inputRange: [0, 1,2],
outputRange: [this.state.range3, this.state.range4-5, this.state.range4]
})
var subMenu2 = this.animatedValue.interpolate({
inputRange: [0, 1, 2],
outputRange: [this.state.range5, this.state.range6-5, this.state.range6]
})
return (
<Animated.View style={{position: 'absolute', left: mainMenu}}>
<Text onPress={() => this.startAnimation(1)}>submenu item 1
<Text onPress={() => this.startAnimation(2)}>submenu item 2
item 3
item 4
</Animated.View>
<Animated.View style={{position: 'absolute', left: subMenu1}}>
<Text onPress={() => this.startAnimation(1)}>return to main menu
submenu 1 item 1
submenu 1 item 2
</Animated.View>
<Animated.View style={{position: 'absolute', left: subMenu2}}>
<Text onPress={() => this.startAnimation(2)}>return to main menu
submenu 2 item 1
submenu 2 item 2
</Animated.View>
);
}
};
const styles = StyleSheet.create({
menu: {
position: 'absolute',
left: 0,
top: 0,
bottom: 0,
flex: 1,
width: window.width+500,
height: window.height,
backgroundColor: 'gray',
padding: 20,
maxWidth: window.width+100
},
menu2: {
position: 'absolute',
left: 300,
top: 0,
bottom: 0,
flex: 1,
width: window.width+500,
height: window.height,
backgroundColor: 'gray',
padding: 20,
maxWidth: window.width+100
},
avatarContainer: {
marginBottom: 20,
marginTop: 20,
},
avatar: {
width: 48,
height: 48,
borderRadius: 24,
flex: 1,
},
item: {
fontSize: 14,
fontWeight: '300',
paddingTop: 5,
},
});
from react-native-elements.
@forumics check out issue #115 we're going to be replacing this component with react-native-side-menu
from react-native-elements.
Related Issues (20)
- FAB when rendered on web Warning: validateDOMNesting(...): <button> cannot appear as a descendant of <button>. HOT 4
- import { styled } from '@rneui/themed' doesn't work HOT 2
- Feature Request - Animated Shrink Button with Loading Indicator
- Avatar ignoring resize mode on initial load HOT 18
- ButtonGroup fails on iOS Expo Dev Client HOT 1
- Feature request - Circular progress component
- The documentation sidebar is not taking the correct height on mobile screens.
- The search glass is not available in Chrome browser
- Dialog.Title does not honor Dark mode text color HOT 3
- SpeedDial cant work in web platform,cuz ``` [...new Array(React.Children.count(children))]``` will returned ```[empty × 2]``` HOT 2
- NPM version missmatch for @rneui/themed's peerDeps/devDeps HOT 1
- Unable to import styled helper HOT 1
- ref prop is not working for Button component of New React native element lib (@rneui/base & @rneui/themed) HOT 2
- Upgrade Expo version for Expo demo HOT 1
- [Feature Request] For web renders, let `Icon` and `Chip` render as `<button>` only if it needs to be clickable HOT 1
- Latest @rneui/themed has incorrect peer and dev dependency HOT 1
- SearchBar has no Cancel button on iOS HOT 3
- TextProps are extended by ListItem.Content instead of ListItem.Title
- Show default image when source load fail HOT 1
- Cannot use Button as child of Link. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-elements.