React native web scrollview snap? - reactjs

I'm using scrollview with react native web and I am trying to get the scrollview to snap into place however it just scroll like normal. I have tried using these props but it isn't working.
horizontal= {true}
decelerationRate={0}
snapToInterval={200} //your element width
snapToAlignment={"center"}

Unfortunately this does not seem to be currently implemented :(
Source: https://github.com/necolas/react-native-web/issues/1250
There is always pagingEnabled={true} but this is not exatcly the same thing.

Related

How would I make a Custom Switch and Toggle Like this In react Native

I am Trying to make a custom switch in react native expo but all the NPM's components don't seem to work, how would i come about creating a custom switch with animations and a custom toggle like the ones show in the image with react native expo?
What I am trying to make
To achieve your first switch example you can look at react-native-switch and tweak it slightly to take a height and width (instead of circle size). I have a working example of this here.
For your second example a simple TouchableOpacity with toggle icon should suffice. You can get a little more elborate and add a color animation if you wanted.

React Native scroll interaction blocks tap/touch events

I'm using a bunch of ScrollViews in my Expo React Native application, and I've noticed that whenever the ScrollView animation is still happening, I am unable to tap any TouchableHighlights or TouchableOpacity elements until the animation has fully stopped.
Is this type of blocking expected behaviour, and is there any way to circumvent this? Running on iOS.
Thanks!
Did you use like this??
<ScrollView keyboardShouldPersistTaps="always">
// all stuff here
</ScrollView>;
Use keyboardShouldPersistTaps and set it to always. This should solve your problem.

How can I fix scrolling and layout issues when using react navigation?

I am currently having an issue where using a StackNavigator (created using createStackNavigator) is messing up the layout of my component.
I have attached images to explain the problem! You can see, on the first run of the app, when I just directly render the view, the component renders fine. Then, when I change it to render my navigator (whose component is the same StartPartyPageView), the layout gets messed up.
Also, when rendering within a navigator, I am unable to scroll my scroll view.
Does anyone know what could be going on here?
This is where it is working:
This is where it is not working:

Change pages by swiping in React

Is there a way to swipe between pages in react?
Something like: https://www.npmjs.com/package/react-page-transitions but using swipe as a trigger.
For actual routing on page swipe, you would have to look at the routing library you use.
However if you want a quick one inside of a route, you can use a pagingEnabled attribute on a <ScrollView>:
<ScrollView horizontal pagingEnabled>
<View>page 1</View>
<View>page 2</View>
</ScrollView>
edit: my mistake, you are asking in react, i got confused by your react-native tag. please remove that if you do not want a react-native reply

Pushing a view from bottom with NavigatorIOS

I am trying to push a view from the bottom of the screen using react native
Looking at the react native NavigatorIOS documentation I can't find anything.
Any recommendation?
You can do that using Navigator, not NavigatorIOS.
Look at https://facebook.github.io/react-native/docs/navigator.html#configurescene
Here's an example:
https://github.com/aaronksaunders/React-Modal-Nav-Example
Credits to aaronksaunders

Resources