Comments (14)
@jkdrangel : I made some changes, here you find the modified react-native-switch-selector file: https://snack.expo.io/HJhKQmAJX
- onPress returns the selected status, not just the value
- added bold
- added height
- added valuePadding
There is the valuePadding to be fixed, considering the height set.
this value should have only two values 1 or 2, higher values would lose significance.
in case only if hasPadding == true.
A nice idea would do such a thing: https://cdn-images-1.medium.com/max/800/1*fFIPdEtcEbDlR8akHCDbOg.jpeg
In place of the tab use this component to be able to change the tabs, simply with the slider.
https://hackernoon.com/how-to-use-a-custom-header-and-custom-bottom-tab-bar-for-react-native-with-react-navigation-969a5d3cabb1
from react-native-switch-selector.
@Angelk90 thanks for your contributions. I added a new prop returnObject to keep consistence with old versions.
1.1.7
from react-native-switch-selector.
@jkdrangel : What do you think of the idea of creating a tab-slider?
from react-native-switch-selector.
@Angelk90, I can not think now. This component was created for a project and I'm only maintenance it now because of other demand, but i think that with few changes this component can turn a tab-slider.
from react-native-switch-selector.
@jkdrangel : I asked you why the code is yours.
I was trying to think how to do it, more or less I'm almost successful, except for the fact that when I'm on the page and I have to make the slider to the right or left I still do not know how to change the page.
It was because I did not want to take advantage of the code you wrote.
In the event that I posted it on github.
from react-native-switch-selector.
@Angelk90, I do not see problem in that this code is availed in another project. You can take advantage of what you have here and reference it. Maybe I can contribute in your tab-slider later too.
I did something similar with a custom tab using conditional rendering, you can try this to solve the problem.
from react-native-switch-selector.
OnPress has changed a state in the parent component that has a conditional rendering based on that state.
from react-native-switch-selector.
@jkdrangel : I thought about using the ScrollView?
But I'm not understanding why it does not work.
Link: https://snack.expo.io/ByWUw2C17
If you can take a look. ;)
from react-native-switch-selector.
@Angelk90 , here the content is changed when I change the selector. What the problem?
from react-native-switch-selector.
@jkdrangel : The problem is that on the page if I wanted to make a slide on the page to the right or left, I would like to change the page.
from react-native-switch-selector.
In this case the panResponder code in the switch selector should be present in the screen too, and force the update of the selected value in selector.
from react-native-switch-selector.
@jkdrangel : This is what I managed to do: https://snack.expo.io/SJTWdR0Jm
But there are some things that do not convince me:
- The movement seems to take place on the contrary.
If I have to go to the right I go to the left.
if I have to go to the left I go to the right. - I would like to create a transition effect between pages, but I do not know how I could do it.
Some advice?
from react-native-switch-selector.
You can change the increments in the responderEnd.
As for the transition, maybe the layoutAnimation will help.
from react-native-switch-selector.
@jkdrangel :
I did it this way it works, change to:
sx con dx the other way around
_getSwipeDirection(gestureState) {
const { dx, dy, vx } = gestureState;
// 0.1 velocity
if (Math.abs(vx) > 0.1 && Math.abs(dy) < 80) {
return dx > 0 ? 'LEFT' : 'RIGHT';
}
return null;
}
But do you think it's logically wrong?
P.s.
You could give me a hand with this animation thing, I'm not very competent in this field, I do not know if I could.
from react-native-switch-selector.
Related Issues (20)
- Warning: componentWillReceiveProps is deprecated in 0.60 HOT 2
- valuePadding not working properly
- Add eslint in .circleci/config.yml HOT 2
- goBack and navigate again no border color and button color
- React Web version HOT 1
- Previous value on componentDidUpdate() HOT 1
- No spacing at the top on the button HOT 4
- Configuring initial with conditional based on prop HOT 2
- Change value dynamically after the initial render HOT 5
- Invalid prop type `options` HOT 3
- Problems with textColor and selectedColor HOT 2
- Custom font HOT 1
- Toggle not changed after change initial state at run time. HOT 3
- Accessibility Label HOT 5
- Switch selector not changing its values in "options" attribute when translated. HOT 1
- Allow change easing animation
- Change only de border color
- Change only the border color HOT 3
- Only one is usable per page
- SyntaxError: Support for the experimental syntax 'jsx' isn't currently enabled (154:9) 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-switch-selector.