Why does 'offset' exist in React Native Panresponder?Hide keyboard in react-nativeWhat is the difference between using constructor vs getInitialState in React / React Native?What is the difference between React Native and React?When using React Native Animated, it possible to animate the offset?Image drag and drop activate scroll ListView (react-native)React-Native why are the animations not linear and from the released place?React Native Animated PanResponder reverse on second inputPanResponder with Aniamted library FROM - TO valueAnimated event react nativeonStartShouldSetPanResponder vs onMoveShouldSetPanResponder in React Native

Is there a context where the expression `a.b::c` makes sense?

How do I superimpose two math symbols?

What does kpsewhich stand for?

Parallel fifths in the orchestra

Is it legal to have an abortion in another state or abroad?

Why did Jon Snow do this immoral act if he is so honorable?

Python program to find Armstrong numbers in a certain range

How do I get the ς (final sigma) symbol?

Shorten or merge multiple lines of `&> /dev/null &`

Did 20% of US soldiers in Vietnam use heroin, 95% of whom quit afterwards?

Is it possible to remotely hack the GPS system and disable GPS service worldwide?

Find this cartoon

Do photons bend spacetime or not?

Why do we need to chain the blocks (creating blockchain) in a permissioned blockchain?

Are black holes spherical during merger?

Does French have the English "short i" vowel?

Grade-school elementary algebra presented in an abstract-algebra style?

Non-containing subsets of two sizes

What is the lower bound for lightspeed?

Beginner looking to learn/master musical theory and instrumental ability. Where should I begin?

便利な工具 what does な means

I know that there is a preselected candidate for a position to be filled at my department. What should I do?

Is my plasma cannon concept viable?

Why are Stein manifolds/spaces the analog of affine varieties/schemes in algebraic geometry?



Why does 'offset' exist in React Native Panresponder?


Hide keyboard in react-nativeWhat is the difference between using constructor vs getInitialState in React / React Native?What is the difference between React Native and React?When using React Native Animated, it possible to animate the offset?Image drag and drop activate scroll ListView (react-native)React-Native why are the animations not linear and from the released place?React Native Animated PanResponder reverse on second inputPanResponder with Aniamted library FROM - TO valueAnimated event react nativeonStartShouldSetPanResponder vs onMoveShouldSetPanResponder in React Native






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















TL;DR: I am using the Panresponder code from the React Native docs, and need help understanding why the 'offset' value is used, as opposed to just using the animated value.



Full Question:



The Scenario:



I am using a Panresponder in React Native to drag and drop objects around the screen. I am using standard code from the RN docs.



Basically, the draggable object has an animated position value. When you click the object, the offset on that animated value is set to the animated value, and the animated value is set to zero. As you drag, the animated value is incrementally set to the magnitude of how far it has been dragged in that gesture. When you release the object, the offset is added to the animated value, and the offset is then set to zero.



Example:



For example, if the object starts from position 0, then initially both the animated value and the offset are set to 0. If you drag the object by 100px, the animated value gradually increases from 0 to 100 as you drag. When you release, the zero offset is added to the animated value (so nothing happens). If you click the object again, the offset is set to 100, and the animated value is re-set to 0. If you drag the object another 50px, the animated value increases from 0 to 50. When you release the object, the 100 offset is added to the animated value, which becomes 150, and the offset is re-set to zero.



In this way, the animated value always holds the distance dragged in the current gesture, with the offset saving the position that the object was at before the current drag gesture started, and when you release the object, that saved offset value is tacked onto the animated value, so that when the object is at rest, the animated value contains the total distance that the object has been dragged by all gestures combined.



Code:



Here's the code I'm using to do this:



this.animatedValue.addListener((value) => this._value = value); // Make this._value hold the value of this.animatedValue (essentially extract the x and y values from the more complex animatedValue)
this.panResponder = PanResponder.create(
onPanResponderGrant: () => // When user clicks to initiate drag
this.animatedValue.setOffset( // Save 'distance dragged so far' in offset
x: this._value.x,
y: this._value.y,
)
this.animatedValue.setValue( x: 0, y: 0) // Set this.animatedValue to (0, 0) so that it will hold only 'distance so far in current gesture'
,
onPanResponderMove: Animated.event([ // As object is dragged, continually update animatedValue
null, dx: this.animatedValue.x, dy: this.animatedValue.y
]),
onPanResponderRelease: (e, gestureState) => // On release, add offset to animatedValue and re-set offset to zero.
this.animatedValue.flattenOffset();




My Question:



This code works perfectly well. When I don't understand though, is why do we need the offset? Why do we need to re-set the animated value to zero on every new gesture, save its value in offset, and re-add that to the animated value after it's finished being dragged? When the object is released, it ends up just holding the total distance dragged, so why not just use the animated value and not use the offset? With my example above, why not just increment animated value to 100 when you drag it 100px, then when you click and drag it again, keep updating the animated value?



Possible Solution:



The only advantage I can think of to using the offset is that animatedValue will now allow you to keep track of the 'distance so far in current gesture', as opposed to just 'total distance so far over all gestures combined'. There might be a scenario in which you need the 'distance so far in current gesture' value, so I'm wondering if this is the only reason to ever use the offset, or is there a more fundamental reason I'm missing why we should use it all the time?



Any insight would be great.



Thanks!










share|improve this question




























    0















    TL;DR: I am using the Panresponder code from the React Native docs, and need help understanding why the 'offset' value is used, as opposed to just using the animated value.



    Full Question:



    The Scenario:



    I am using a Panresponder in React Native to drag and drop objects around the screen. I am using standard code from the RN docs.



    Basically, the draggable object has an animated position value. When you click the object, the offset on that animated value is set to the animated value, and the animated value is set to zero. As you drag, the animated value is incrementally set to the magnitude of how far it has been dragged in that gesture. When you release the object, the offset is added to the animated value, and the offset is then set to zero.



    Example:



    For example, if the object starts from position 0, then initially both the animated value and the offset are set to 0. If you drag the object by 100px, the animated value gradually increases from 0 to 100 as you drag. When you release, the zero offset is added to the animated value (so nothing happens). If you click the object again, the offset is set to 100, and the animated value is re-set to 0. If you drag the object another 50px, the animated value increases from 0 to 50. When you release the object, the 100 offset is added to the animated value, which becomes 150, and the offset is re-set to zero.



    In this way, the animated value always holds the distance dragged in the current gesture, with the offset saving the position that the object was at before the current drag gesture started, and when you release the object, that saved offset value is tacked onto the animated value, so that when the object is at rest, the animated value contains the total distance that the object has been dragged by all gestures combined.



    Code:



    Here's the code I'm using to do this:



    this.animatedValue.addListener((value) => this._value = value); // Make this._value hold the value of this.animatedValue (essentially extract the x and y values from the more complex animatedValue)
    this.panResponder = PanResponder.create(
    onPanResponderGrant: () => // When user clicks to initiate drag
    this.animatedValue.setOffset( // Save 'distance dragged so far' in offset
    x: this._value.x,
    y: this._value.y,
    )
    this.animatedValue.setValue( x: 0, y: 0) // Set this.animatedValue to (0, 0) so that it will hold only 'distance so far in current gesture'
    ,
    onPanResponderMove: Animated.event([ // As object is dragged, continually update animatedValue
    null, dx: this.animatedValue.x, dy: this.animatedValue.y
    ]),
    onPanResponderRelease: (e, gestureState) => // On release, add offset to animatedValue and re-set offset to zero.
    this.animatedValue.flattenOffset();




    My Question:



    This code works perfectly well. When I don't understand though, is why do we need the offset? Why do we need to re-set the animated value to zero on every new gesture, save its value in offset, and re-add that to the animated value after it's finished being dragged? When the object is released, it ends up just holding the total distance dragged, so why not just use the animated value and not use the offset? With my example above, why not just increment animated value to 100 when you drag it 100px, then when you click and drag it again, keep updating the animated value?



    Possible Solution:



    The only advantage I can think of to using the offset is that animatedValue will now allow you to keep track of the 'distance so far in current gesture', as opposed to just 'total distance so far over all gestures combined'. There might be a scenario in which you need the 'distance so far in current gesture' value, so I'm wondering if this is the only reason to ever use the offset, or is there a more fundamental reason I'm missing why we should use it all the time?



    Any insight would be great.



    Thanks!










    share|improve this question
























      0












      0








      0








      TL;DR: I am using the Panresponder code from the React Native docs, and need help understanding why the 'offset' value is used, as opposed to just using the animated value.



      Full Question:



      The Scenario:



      I am using a Panresponder in React Native to drag and drop objects around the screen. I am using standard code from the RN docs.



      Basically, the draggable object has an animated position value. When you click the object, the offset on that animated value is set to the animated value, and the animated value is set to zero. As you drag, the animated value is incrementally set to the magnitude of how far it has been dragged in that gesture. When you release the object, the offset is added to the animated value, and the offset is then set to zero.



      Example:



      For example, if the object starts from position 0, then initially both the animated value and the offset are set to 0. If you drag the object by 100px, the animated value gradually increases from 0 to 100 as you drag. When you release, the zero offset is added to the animated value (so nothing happens). If you click the object again, the offset is set to 100, and the animated value is re-set to 0. If you drag the object another 50px, the animated value increases from 0 to 50. When you release the object, the 100 offset is added to the animated value, which becomes 150, and the offset is re-set to zero.



      In this way, the animated value always holds the distance dragged in the current gesture, with the offset saving the position that the object was at before the current drag gesture started, and when you release the object, that saved offset value is tacked onto the animated value, so that when the object is at rest, the animated value contains the total distance that the object has been dragged by all gestures combined.



      Code:



      Here's the code I'm using to do this:



      this.animatedValue.addListener((value) => this._value = value); // Make this._value hold the value of this.animatedValue (essentially extract the x and y values from the more complex animatedValue)
      this.panResponder = PanResponder.create(
      onPanResponderGrant: () => // When user clicks to initiate drag
      this.animatedValue.setOffset( // Save 'distance dragged so far' in offset
      x: this._value.x,
      y: this._value.y,
      )
      this.animatedValue.setValue( x: 0, y: 0) // Set this.animatedValue to (0, 0) so that it will hold only 'distance so far in current gesture'
      ,
      onPanResponderMove: Animated.event([ // As object is dragged, continually update animatedValue
      null, dx: this.animatedValue.x, dy: this.animatedValue.y
      ]),
      onPanResponderRelease: (e, gestureState) => // On release, add offset to animatedValue and re-set offset to zero.
      this.animatedValue.flattenOffset();




      My Question:



      This code works perfectly well. When I don't understand though, is why do we need the offset? Why do we need to re-set the animated value to zero on every new gesture, save its value in offset, and re-add that to the animated value after it's finished being dragged? When the object is released, it ends up just holding the total distance dragged, so why not just use the animated value and not use the offset? With my example above, why not just increment animated value to 100 when you drag it 100px, then when you click and drag it again, keep updating the animated value?



      Possible Solution:



      The only advantage I can think of to using the offset is that animatedValue will now allow you to keep track of the 'distance so far in current gesture', as opposed to just 'total distance so far over all gestures combined'. There might be a scenario in which you need the 'distance so far in current gesture' value, so I'm wondering if this is the only reason to ever use the offset, or is there a more fundamental reason I'm missing why we should use it all the time?



      Any insight would be great.



      Thanks!










      share|improve this question














      TL;DR: I am using the Panresponder code from the React Native docs, and need help understanding why the 'offset' value is used, as opposed to just using the animated value.



      Full Question:



      The Scenario:



      I am using a Panresponder in React Native to drag and drop objects around the screen. I am using standard code from the RN docs.



      Basically, the draggable object has an animated position value. When you click the object, the offset on that animated value is set to the animated value, and the animated value is set to zero. As you drag, the animated value is incrementally set to the magnitude of how far it has been dragged in that gesture. When you release the object, the offset is added to the animated value, and the offset is then set to zero.



      Example:



      For example, if the object starts from position 0, then initially both the animated value and the offset are set to 0. If you drag the object by 100px, the animated value gradually increases from 0 to 100 as you drag. When you release, the zero offset is added to the animated value (so nothing happens). If you click the object again, the offset is set to 100, and the animated value is re-set to 0. If you drag the object another 50px, the animated value increases from 0 to 50. When you release the object, the 100 offset is added to the animated value, which becomes 150, and the offset is re-set to zero.



      In this way, the animated value always holds the distance dragged in the current gesture, with the offset saving the position that the object was at before the current drag gesture started, and when you release the object, that saved offset value is tacked onto the animated value, so that when the object is at rest, the animated value contains the total distance that the object has been dragged by all gestures combined.



      Code:



      Here's the code I'm using to do this:



      this.animatedValue.addListener((value) => this._value = value); // Make this._value hold the value of this.animatedValue (essentially extract the x and y values from the more complex animatedValue)
      this.panResponder = PanResponder.create(
      onPanResponderGrant: () => // When user clicks to initiate drag
      this.animatedValue.setOffset( // Save 'distance dragged so far' in offset
      x: this._value.x,
      y: this._value.y,
      )
      this.animatedValue.setValue( x: 0, y: 0) // Set this.animatedValue to (0, 0) so that it will hold only 'distance so far in current gesture'
      ,
      onPanResponderMove: Animated.event([ // As object is dragged, continually update animatedValue
      null, dx: this.animatedValue.x, dy: this.animatedValue.y
      ]),
      onPanResponderRelease: (e, gestureState) => // On release, add offset to animatedValue and re-set offset to zero.
      this.animatedValue.flattenOffset();




      My Question:



      This code works perfectly well. When I don't understand though, is why do we need the offset? Why do we need to re-set the animated value to zero on every new gesture, save its value in offset, and re-add that to the animated value after it's finished being dragged? When the object is released, it ends up just holding the total distance dragged, so why not just use the animated value and not use the offset? With my example above, why not just increment animated value to 100 when you drag it 100px, then when you click and drag it again, keep updating the animated value?



      Possible Solution:



      The only advantage I can think of to using the offset is that animatedValue will now allow you to keep track of the 'distance so far in current gesture', as opposed to just 'total distance so far over all gestures combined'. There might be a scenario in which you need the 'distance so far in current gesture' value, so I'm wondering if this is the only reason to ever use the offset, or is there a more fundamental reason I'm missing why we should use it all the time?



      Any insight would be great.



      Thanks!







      reactjs react-native animation gesture






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 0:25









      gkeenleygkeenley

      3269




      3269






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Because it's better to have the entire animated value's state be self-contained, so you can pass its value to a transform. Of course maybe you don't want the "total distance travelled" in which case, well, don't use offsets, but if you do, using AnimatedValue's offset is the best solution.



          Let me show you why by coding up an example of tracking the total distance travelled between touches without using the built-in offset:



          this.offsetValue = x: 0, y:0;
          this.panResponder = PanResponder.create(
          onPanResponderGrant: () => // When user clicks to initiate drag
          this.animatedValue.setValue( x: 0, y: 0) // Set this.animatedValue to (0, 0) so that it will hold only 'distance so far in current gesture'
          ,
          onPanResponderMove: Animated.event([ // As object is dragged, continually update animatedValue
          null, dx: this.animatedValue.x, dy: this.animatedValue.y
          ]),
          onPanResponderRelease: (e, gestureState) =>
          // Set the offset to the current position
          this.offsetValue = x: gestureState.dx, y: gestureState.dy
          // Reset our animatedvalue since the offset is now all good
          this.animatedValue.setValue( x: 0, y: 0)




          This works, and it's less code you now have the raw value for the current touch in Animated.Value and if you want the total distance moved you can use this.offsetValue. Except... how do you apply it to get the total distance exactly? You might think you can do this:



          <Animated.View
          style=
          transform: [
          translateX: this.offset.x + this.animatedValue.x ,
          translateY: this.offset.y + this.animatedValue.y ,
          ],

          ...this.panResponder.panHandlers
          />


          But this will be an error because animatedValue.x isn't a number obviously. You could use ._value directly but then what's the point of using Animated? The entire idea is that you can pass a single Animated object to a transform property. So that's why you simply use the object's internal offset.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55319640%2fwhy-does-offset-exist-in-react-native-panresponder%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Because it's better to have the entire animated value's state be self-contained, so you can pass its value to a transform. Of course maybe you don't want the "total distance travelled" in which case, well, don't use offsets, but if you do, using AnimatedValue's offset is the best solution.



            Let me show you why by coding up an example of tracking the total distance travelled between touches without using the built-in offset:



            this.offsetValue = x: 0, y:0;
            this.panResponder = PanResponder.create(
            onPanResponderGrant: () => // When user clicks to initiate drag
            this.animatedValue.setValue( x: 0, y: 0) // Set this.animatedValue to (0, 0) so that it will hold only 'distance so far in current gesture'
            ,
            onPanResponderMove: Animated.event([ // As object is dragged, continually update animatedValue
            null, dx: this.animatedValue.x, dy: this.animatedValue.y
            ]),
            onPanResponderRelease: (e, gestureState) =>
            // Set the offset to the current position
            this.offsetValue = x: gestureState.dx, y: gestureState.dy
            // Reset our animatedvalue since the offset is now all good
            this.animatedValue.setValue( x: 0, y: 0)




            This works, and it's less code you now have the raw value for the current touch in Animated.Value and if you want the total distance moved you can use this.offsetValue. Except... how do you apply it to get the total distance exactly? You might think you can do this:



            <Animated.View
            style=
            transform: [
            translateX: this.offset.x + this.animatedValue.x ,
            translateY: this.offset.y + this.animatedValue.y ,
            ],

            ...this.panResponder.panHandlers
            />


            But this will be an error because animatedValue.x isn't a number obviously. You could use ._value directly but then what's the point of using Animated? The entire idea is that you can pass a single Animated object to a transform property. So that's why you simply use the object's internal offset.






            share|improve this answer



























              0














              Because it's better to have the entire animated value's state be self-contained, so you can pass its value to a transform. Of course maybe you don't want the "total distance travelled" in which case, well, don't use offsets, but if you do, using AnimatedValue's offset is the best solution.



              Let me show you why by coding up an example of tracking the total distance travelled between touches without using the built-in offset:



              this.offsetValue = x: 0, y:0;
              this.panResponder = PanResponder.create(
              onPanResponderGrant: () => // When user clicks to initiate drag
              this.animatedValue.setValue( x: 0, y: 0) // Set this.animatedValue to (0, 0) so that it will hold only 'distance so far in current gesture'
              ,
              onPanResponderMove: Animated.event([ // As object is dragged, continually update animatedValue
              null, dx: this.animatedValue.x, dy: this.animatedValue.y
              ]),
              onPanResponderRelease: (e, gestureState) =>
              // Set the offset to the current position
              this.offsetValue = x: gestureState.dx, y: gestureState.dy
              // Reset our animatedvalue since the offset is now all good
              this.animatedValue.setValue( x: 0, y: 0)




              This works, and it's less code you now have the raw value for the current touch in Animated.Value and if you want the total distance moved you can use this.offsetValue. Except... how do you apply it to get the total distance exactly? You might think you can do this:



              <Animated.View
              style=
              transform: [
              translateX: this.offset.x + this.animatedValue.x ,
              translateY: this.offset.y + this.animatedValue.y ,
              ],

              ...this.panResponder.panHandlers
              />


              But this will be an error because animatedValue.x isn't a number obviously. You could use ._value directly but then what's the point of using Animated? The entire idea is that you can pass a single Animated object to a transform property. So that's why you simply use the object's internal offset.






              share|improve this answer

























                0












                0








                0







                Because it's better to have the entire animated value's state be self-contained, so you can pass its value to a transform. Of course maybe you don't want the "total distance travelled" in which case, well, don't use offsets, but if you do, using AnimatedValue's offset is the best solution.



                Let me show you why by coding up an example of tracking the total distance travelled between touches without using the built-in offset:



                this.offsetValue = x: 0, y:0;
                this.panResponder = PanResponder.create(
                onPanResponderGrant: () => // When user clicks to initiate drag
                this.animatedValue.setValue( x: 0, y: 0) // Set this.animatedValue to (0, 0) so that it will hold only 'distance so far in current gesture'
                ,
                onPanResponderMove: Animated.event([ // As object is dragged, continually update animatedValue
                null, dx: this.animatedValue.x, dy: this.animatedValue.y
                ]),
                onPanResponderRelease: (e, gestureState) =>
                // Set the offset to the current position
                this.offsetValue = x: gestureState.dx, y: gestureState.dy
                // Reset our animatedvalue since the offset is now all good
                this.animatedValue.setValue( x: 0, y: 0)




                This works, and it's less code you now have the raw value for the current touch in Animated.Value and if you want the total distance moved you can use this.offsetValue. Except... how do you apply it to get the total distance exactly? You might think you can do this:



                <Animated.View
                style=
                transform: [
                translateX: this.offset.x + this.animatedValue.x ,
                translateY: this.offset.y + this.animatedValue.y ,
                ],

                ...this.panResponder.panHandlers
                />


                But this will be an error because animatedValue.x isn't a number obviously. You could use ._value directly but then what's the point of using Animated? The entire idea is that you can pass a single Animated object to a transform property. So that's why you simply use the object's internal offset.






                share|improve this answer













                Because it's better to have the entire animated value's state be self-contained, so you can pass its value to a transform. Of course maybe you don't want the "total distance travelled" in which case, well, don't use offsets, but if you do, using AnimatedValue's offset is the best solution.



                Let me show you why by coding up an example of tracking the total distance travelled between touches without using the built-in offset:



                this.offsetValue = x: 0, y:0;
                this.panResponder = PanResponder.create(
                onPanResponderGrant: () => // When user clicks to initiate drag
                this.animatedValue.setValue( x: 0, y: 0) // Set this.animatedValue to (0, 0) so that it will hold only 'distance so far in current gesture'
                ,
                onPanResponderMove: Animated.event([ // As object is dragged, continually update animatedValue
                null, dx: this.animatedValue.x, dy: this.animatedValue.y
                ]),
                onPanResponderRelease: (e, gestureState) =>
                // Set the offset to the current position
                this.offsetValue = x: gestureState.dx, y: gestureState.dy
                // Reset our animatedvalue since the offset is now all good
                this.animatedValue.setValue( x: 0, y: 0)




                This works, and it's less code you now have the raw value for the current touch in Animated.Value and if you want the total distance moved you can use this.offsetValue. Except... how do you apply it to get the total distance exactly? You might think you can do this:



                <Animated.View
                style=
                transform: [
                translateX: this.offset.x + this.animatedValue.x ,
                translateY: this.offset.y + this.animatedValue.y ,
                ],

                ...this.panResponder.panHandlers
                />


                But this will be an error because animatedValue.x isn't a number obviously. You could use ._value directly but then what's the point of using Animated? The entire idea is that you can pass a single Animated object to a transform property. So that's why you simply use the object's internal offset.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered May 3 at 10:17









                Thomas NThomas N

                11




                11



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55319640%2fwhy-does-offset-exist-in-react-native-panresponder%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해