0

I am trying to create a selector in react native using PANRESPONDER in reactNative. Actually width of a View is oriented from left to right, and Height of the View is oriented from top to bottom. I want to dynamically reverse the box. So I am giving width and height as a negative Value. But the View disappears. How could I reverse the View ?

Supermacy
  • 1,429
  • 15
  • 24

1 Answers1

1

If anybody ends up here looking for how to make a value negative of say the screen dimensions so you can move an element around in say a slider..

let screenWidth = Dimensions.get('window').width;
let screenWidthNegative = parseInt('-' + screenWidth);

<View style={[styles.thisViewsStyle, {marginLeft: screenWidthNegative}]}></View>
Hastig Zusammenstellen
  • 4,286
  • 3
  • 32
  • 45