Closed os-kingsley closed 3 years ago
Use the :ref
prop. It will allow you to use the React ref on the component. $refs
will give you a Vue ref. In Vue Native it is possible to use both, but they will work differently.
The React ref can be managed in the same way as in React Native (using a function)
In the template:
:ref="(ref) => {
compRef = ref
}"
compRef
needs to be declared in your script
data() {
return {
// ...
compRef: null,
}
},
It might make more sense to manage the ref using $options
instead of data
, since data
is reactive, but you'll need to experiment with that a bit, since I'm not sure if it would work as intended.
Please close this issue if this solves it for you.
Closing due to inactivity. Please reopen if anyone faces issues with the provided solution
Trying to use ref in vue native but getting
undefined is not an object(evaluating this.$refs.pinView...
The react native component has this example
How can i do this correctly using vue native?