Coder Social home page Coder Social logo

Comments (14)

Angelk90 avatar Angelk90 commented on July 19, 2024 2

@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.

jkdrangel avatar jkdrangel commented on July 19, 2024

@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.

Angelk90 avatar Angelk90 commented on July 19, 2024

@jkdrangel : What do you think of the idea of creating a tab-slider?

from react-native-switch-selector.

jkdrangel avatar jkdrangel commented on July 19, 2024

@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.

Angelk90 avatar Angelk90 commented on July 19, 2024

@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.

jkdrangel avatar jkdrangel commented on July 19, 2024

@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.

jkdrangel avatar jkdrangel commented on July 19, 2024

OnPress has changed a state in the parent component that has a conditional rendering based on that state.

from react-native-switch-selector.

Angelk90 avatar Angelk90 commented on July 19, 2024

@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.

jkdrangel avatar jkdrangel commented on July 19, 2024

@Angelk90 , here the content is changed when I change the selector. What the problem?

from react-native-switch-selector.

Angelk90 avatar Angelk90 commented on July 19, 2024

@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.

jkdrangel avatar jkdrangel commented on July 19, 2024

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.

Angelk90 avatar Angelk90 commented on July 19, 2024

@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.

jkdrangel avatar jkdrangel commented on July 19, 2024

You can change the increments in the responderEnd.
As for the transition, maybe the layoutAnimation will help.

from react-native-switch-selector.

Angelk90 avatar Angelk90 commented on July 19, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.